Maven - 获取依赖源jar的路径

Maven - getting path of dependency source jar

这与关于获取依赖 jar 路径的类似问题有关 - Can I use the path to a Maven dependency as a property?

在我的例子中,我需要获取源 jar 的路径,源 jar 被列为依赖项并得到解析,但路径未设置为 属性。我尝试了

这样的选项
{groupid:artifactid:sources:jar}
{groupid:artifactid-sources:jar}

有什么关于如何获取路径的建议吗?

不完全是答案,但达到了最终目标。我将依赖插件的复制目标用作:

<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>