0

This is related to a similar question about getting path to a dependency jar - Can I use the path to a Maven dependency as a property?

In my case, I need to get the path to the source jar, source jar is listed as a dependency, and gets resolved, but path is not set to property. I tried options like

{groupid:artifactid:sources:jar}
{groupid:artifactid-sources:jar}

Any suggestions on how to get hold of the path?

Community
  • 1
  • 1
saugata
  • 2,823
  • 1
  • 27
  • 39

1 Answers1

0

Not exactly the answer, but achieves the end goal. I used copy goal of the dependency plugin as:

<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>
saugata
  • 2,823
  • 1
  • 27
  • 39