【问】如上图,IDEA 中点击 Download Source(下载源码)后,下载的源码存储到哪了?
【答】
先找到此源码所属 Jar 包在哪;
点击 Download Source(下载源码)后,会发现存储 Jar 包的位置多了一个后缀带有 -sources 的 Jar 包,这就是 IDEA 为我们下载的源码。
【问】如何找此源码所属 Jar 包在哪?
maven下载不到源码:Cannot download sources Sources not found for:
cmd命令行终端,然后进入到工程文件目录里,就是有pom文件的那个目录里,执行如下命令
mvn dependency:resolve -Dclassifier=sources
1
接下来他就会下载jar和源码了
完事之后,需要去choose Source,位置就和jar在一块
原文链接:
参考链接:https://blog.csdn.net/qq_45634592/article/details/131845271
https://blog.csdn.net/maoyuanming0806/article/details/120079191
dependency:resolve
Resolve is intended to be used from the command line like: mvn dependency:resolve -Dsilent=true
This goal simply tells maven to resolve all test scope (includes compile) dependencies and then displays the resolved versions. This is intended to help ensure all dependencies are downloaded to the local repository. This is useful when troubleshooting or during intermittent remote repository failures when repeatedly building multiproject modules is undersirable and the build is failing on dependency resolution. It can also be used to quickly determine how versions are being resolved.
Artifacts can also be resolved by specifying the classifer and optionally type. Type is only used with the classifier and defaults to java-sources. When the classifier is set, the list of dependencies is used as the base to resolve artifacts with the classifer and type. For example: mvn dependency:resolve -Dclassifer=test-jar
will try to find the test-jar for all dependencies resolve them to the local repository.
dependency:sources
Sources is intended to be used from the command line like: mvn dependency:sources -Dsilent=true
This is the same as the resolve goal except it includes the source attachments if they exist. This is useful when you want to download source attachments to your local repository.
You can also define the markersDirectory
either in the pom or settings to be a common location for all projects. This allows the system to resolve sources faster for dependencies that don't have the sources published. The plugin will store a marker file to describe if the sources were resolved or not. By placing them in a common location, multiple attempts to resolve non-existent sources will be avoided.
标签:resolve,sources,idea,used,maven,dependency,源码,dependencies From: https://www.cnblogs.com/youxin/p/18016374