The error is due to Maven not being able to resolve the dependency on any of the configured repositories, both of the repositories that are default, and what you have explained in your settings (in the case of Primefaces).
Instead of manually including the dependency in your local repository (by default found in .m2
in the user directory) you can add a repository that has such a dependency, since there is an online and public repository that has it.
The sonatype repository (often used, even) has the dependency you need. So to solve the dependency for it, just add something like this to your pom.xml
:
<repository>
<id>sonatype-releases</id>
<url>https://oss.sonatype.org/content/repositories/releases/</url>
</repository>
And after that you’ll be able to solve it, the way you declared or by removing the scope compile
which is standard and may remain so:
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>5.1.2</version>
</dependency>
The approach of saying that dependencies that by nature do not present themselves with scope provided
should be avoided (see the meaning of each scope), since it is great the chance of making mistakes.
Below is a complete example of pom.xml
using the configuration as stated:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.brunocesar</groupId>
<artifactId>jasper-dependency</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>5.1.2</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>sonatype-releases</id>
<url>https://oss.sonatype.org/content/repositories/releases/</url>
</repository>
</repositories>
</project>
This is the dependencies download log:
[INFO] ------------------------------------------------------------------------
[INFO] Building jasper-dependency 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://oss.sonatype.org/content/repositories/releases/net/sf/jasperreports/jasperreports/5.1.2/jasperreports-5.1.2.pom
Downloaded: https://oss.sonatype.org/content/repositories/releases/net/sf/jasperreports/jasperreports/5.1.2/jasperreports-5.1.2.pom (13 KB at 7.5 KB/sec)
Downloading: https://oss.sonatype.org/content/repositories/releases/net/sf/jasperreports/jasperreports/5.1.2/jasperreports-5.1.2.jar
Downloaded: https://oss.sonatype.org/content/repositories/releases/net/sf/jasperreports/jasperreports/5.1.2/jasperreports-5.1.2.jar (4428 KB at 402.8 KB/sec)
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ jasper-dependency ---
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ jasper-dependency ---
[INFO] No sources to compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.988 s
[INFO] Finished at: 2015-08-07T10:51:48-03:00
[INFO] Final Memory: 10M/183M
[INFO] ------------------------------------------------------------------------
As you can see the download was made from the repository mentioned and configured. As in your case it went wrong, some possible causes are:
- wrong configured repository;
- cache in the local Maven repository, force the update using
mvn clean compile -U
or some other Lifecycle
Got it, I’m with Windows, I think I’ll have to wait for the fix, thanks for clarification.
– DiegoAugusto
@Techies in Windows should also be possible to manually add the file to the Maven repository, but I am not aware of the steps. Maybe this page will help you with something: http://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports/5.1.2
– Vinícius Gobbo A. de Oliveira
@Techies found this question from the OS in English which may be the problem resolution: http://stackoverflow.com/questions/16719901/what-are-the-dependecy-need-to-be-added-for-jasperreport-5-0-1
– Vinícius Gobbo A. de Oliveira
I had already seen this question and did not solve either, I believe that their repository is really in trouble. I will try to put manually. Thanks
– DiegoAugusto