Project error after adding Ireport dependency

Asked

Viewed 796 times

3

When I add the dependency following the project and pom.xml get bug:

<dependency>
    <groupId>net.sf.jasperreports</groupId>
    <artifactId>jasperreports</artifactId>
    <version>5.1.2</version>
    <scope>compile</scope>
</dependency>

Error:

Description Resource Path Location Type Artifactdescriptorexception: Failed to read Artifact Descriptor for net.sf.jasperreports:jasperreports:jar:5.1.2: Artifactresolutionexception: Failure to transfer net.sf.jasperreports:jasperreports:pom:5.1.2 from http://repository.primefaces.org was cached in the local Repository, Resolution will not be reattempted until the update interval of prime-Repo has Elapsed or updates are Forced. Original error: Could not transfer Artifact net.sf.jasperreports:jasperreports:pom:5.1.2 from/to prime-Repo (http://repository.primefaces.org): connect timed out pom.xml /Systemssuspensao line 1 Maven Dependency Problem

And not only that, all other dependencies get bug too: inserir a descrição da imagem aqui

I have tried several library versions and the error persists.

2 answers

2


The file does not exist in the repository. At least I did not find it. Hence the error.

It may be that the repository is wrong, or some problem in the repository itself.

One solution would be to add the . jar manually to the . m2 folder (if using Linux) and to the application container, and to change the <scope> for provided.

Or if the problem is in the repository, wait for it to be fixed and then try again.

  • Got it, I’m with Windows, I think I’ll have to wait for the fix, thanks for clarification.

  • @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

  • @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

  • 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

1

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
  • I had already done it manually, but I tried to do as your answer and the error continues.

  • @Techies updated the answer with a full use example, as well as the usage log.

  • And yet the error of missing artifact

  • @Techies ok, must be some other problem in your project, thanks :)

  • Got it, thanks for the help. I tested on other projects and also did not give. I think sometimes can be some configuration

Browser other questions tagged

You are not signed in. Login or sign up in order to post.