sources not found for【IDEA】
方法一:
add <classifier>sources</classifier>
example:
<dependency>
<groupId>xxx</groupId>
<artifactId>xxx</artifactId>
<version>xxx</version>
<classifier>sources</classifier>
</dependency>
方法二
使用【maven-eclipse-plugin】外掛
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-eclipse-plugin</artifactId> <configuration> <downloadSources>true</downloadSources> <downloadJavadocs>true</downloadJavadocs> </configuration> </plugin> </plugins> </build>
方法三
使用mvn命令 Get sources and Javadocs
When you’re using Maven in an IDE you often find the need for your IDE to resolve source code and Javadocs for your library dependencies. There’s an easy way to accomplish that goal.
mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc
The first command will attempt to download source code for each of the dependencies in your pom file.
The second command will attempt to download the Javadocs.
Maven is at the mercy of the library packagers here. So some of them won’t have source code packaged and many of them won’t have Javadocs.
In case you have a lot of dependencies it might also be a good idea to use inclusions/exclusions to get specific artifacts, the following command will for example only download the sources for the dependency with a specific artifactId:
mvn dependency:sources -DincludeArtifactIds=guava
本文參考: https://stackoverflow.com/questions/2059431/get-source-jars-from-maven-repository