Maven trying to load artifacts '-sources.src'?

I have a Maven project that has so far been used to compile without problems. Today, when I run mvn clean package -U , I get:

[ERROR] The target in the myproj project failed: the dependencies for the org.myorg.myproj project were not resolved: myproj: jar: 1.0-SNAPSHOT: The following artifacts could not be resolved: javax.servlet: javax.servlet- api: src: sources: 3.0.1, org.eclipse.jetty: jetty-servlet: src: sources: 8.1.2.v20120308, org.eclipse.jetty: jetty-server: src: sources: 8.1.2.v20120308, org.eclipse. jetty: jetty-webapp: src: sources: 8.1.2.v20120308, commons-io: commons-io: src: sources: 2.4: Could not find artifact javax.servlet: javax.servlet-api: src: sources: 3.0. 1 in MyRepo (http://maven.myorg.org:9001/nexus/content/repositories/myrepo/) → [Help 1]

I tried to create a new local Maven repository ( rm -fr ~/.m2/repository ), but that didn't make any difference.

Why is Maven trying to find source / src artefacts? Any ideas you might have a problem in?

Edit: My dependencies (as shown with mvn help:effective-pom ) do not contain source classifiers. For example, the jetty-server dependency mentioned in the error message looks like this:

 <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-server</artifactId> <version>8.1.2.v20120308</version> <scope>compile</scope> </dependency> 

Solution: With @AlessandroSantini and @ brian-topping, I finally spotted the problem. One of my indirect dependencies was <classifier>sources</classifier> and <type>src</type> . ( mvn help:effective-pom did not display these indirect dependencies, and mvn dependency:tree failed with the above error message, too, in the end, grep -r 'jetty-server' ~/.m2/repository/ -C 3 identified confused dependency artifact.)

It turned out that one of my own SBT projects required (non-existent) source artifacts for one of its dependencies: I used SBT withSources() , where I would have to use sbteclipe EclipseKeys.withSource := true to get sources in Eclipse.

+4
source share
1 answer

Do you have any dependencies on publicly available snapshots? I would look at the output of mvn dependency:tree and see if it is possible to find a transitive dependency that somehow includes sources. Perhaps one of the transit countries has changed since your last build, and they messed up something.

+2
source

Source: https://habr.com/ru/post/1440342/


All Articles