jdee icon indicating copy to clipboard operation
jdee copied to clipboard

Checking the class path causes an error in maven

Open parhamdoustdar opened this issue 7 years ago • 4 comments

When I open a file in my project, dee shows me a buffer with an error about building the class path.

The log will be pasted below, but before that, I would like to note the things i tried:

ƒƒ- Running mvn dependency:build-classpath in the root of my project works with no errors

  • I have also checked that the library mentioned in the log below exists in ~/.m2/repository/org/apache/thrift/libthrift/0.9.2/libthrift-0.9.2.jar
  • I have also verified that the jdee-global-classpath contains the path above.

Below is the buffer I get when I try to open any .java file in my project:

[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building reportapi 0.1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.10:build-classpath (default-cli) @ reportapi ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.133 s
[INFO] Finished at: 2017-05-23T15:59:24+02:00
[INFO] Final Memory: 32M/445M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.10:build-classpath (default-cli) on project reportapi: not found in any repository: org.apache.thrift:libthrift:jar:sources:0.9.2: Failure to find org.apache.thrift:libthrift:jar:sources:0.9.2 in https://nexus.booking.com/nexus/content/repositories/infra-releases/ was cached in the local repository, resolution will not be reattempted until the update interval of infra has elapsed or updates are forced
[ERROR] 
[ERROR] Try downloading the file manually from the project website.
[ERROR] 
[ERROR] Then, install it using the command: 
[ERROR]     mvn install:install-file -DgroupId=org.apache.thrift -DartifactId=libthrift -Dversion=0.9.2 -Dclassifier=sources -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 
[ERROR] Alternatively, if you host your own repository you can deploy the file there: 
[ERROR]     mvn deploy:deploy-file -DgroupId=org.apache.thrift -DartifactId=libthrift -Dversion=0.9.2 -Dclassifier=sources -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR] 
[ERROR] 
[ERROR]   org.apache.thrift:libthrift:jar:0.9.2
[ERROR] 
[ERROR] from the specified remote repositories:
[ERROR]   infra (https://nexus.booking.com/nexus/content/repositories/infra-releases/, releases=true, snapshots=true),
[ERROR]   snapshot (https://nexus.booking.com/nexus/content/repositories/infra-snapshots/, releases=true, snapshots=true),
[ERROR]   infra-snapshots (https://nexus.booking.com/nexus/content/repositories/infra-snapshots/, releases=true, snapshots=true),
[ERROR]   infra-releases (https://nexus.booking.com/nexus/content/repositories/infra-releases/, releases=true, snapshots=true),
[ERROR]   central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false)
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

parhamdoustdar avatar May 24 '17 10:05 parhamdoustdar

Do you have proxy settings in your ~/.m2/settings.xml? Or maybe you have it in your shell (env | grep proxy)?

pwojnowski avatar May 24 '17 11:05 pwojnowski

Thanks for the prompt reply!

Yes, but in none of those locations. Mine is in <project root>/settings.xml, next to the pom.xml file.

parhamdoustdar avatar May 24 '17 11:05 parhamdoustdar

I was running into this issue as well. Maven was complaining that it couldn't find antlr (used by checkstyle). I don't need that on my classpath, so here's how I fixed it:

       <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.8</version>
        <configuration>
          <excludeArtifactIds>antlr</excludeArtifactIds>
        </configuration>
      </plugin>

I'm not sure, but this could be an issue with the dependency plugin. The way this problem reveals itself is very frustrating as emacs runs a maven command that throws open a buffer and spits out an error every time you open a .java file.

It would be nice if there was a sanity checks script to help existing projects get up and running with jdee.

pdex avatar Nov 15 '17 22:11 pdex

This error occurs because mvn dependency:build-classpath -Dclassifier=sources could not be successfuly executed. The root cause: there is no source bundles for some outdated artifacts in central repository:

  • https://mvnrepository.com/artifact/com.google.code.findbugs/annotations/2.0.0
  • https://mvnrepository.com/artifact/antlr/antlr/2.7.7
  • https://mvnrepository.com/artifact/xmlpull/xmlpull/1.1.3.1

I can't imagine simple workaround of this issue. There is no -DignoreMissing or anything like that flag on maven-dependency-plugin manual page: https://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.html

Probably, the only way is to contribute such -DignoreMissing functionality into maven-dependency-plugin.

badbob avatar Dec 13 '17 16:12 badbob