这与关于获取依赖关系jar的路径的类似问题有关 - Can I use the path to a Maven dependency as a property?
在我的情况下,我需要获取源jar的路径,源jar被列为依赖项,并得到解决,但路径未设置为property。我试过像
这样的选项{groupid:artifactid:sources:jar}
{groupid:artifactid-sources:jar}
有关如何掌握路径的任何建议?
答案 0 :(得分:0)
不完全是答案,但实现了最终目标。我使用依赖插件的复制目标:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.example</groupId>
<artifactId>myjar</artifactId>
<version>${version}</version>
<classifier>sources</classifier>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/myjar-src</outputDirectory>
<destFileName>myjar-src.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>