使用项目依赖的来源

这与复制项目依赖项或解包项目依赖项示例非常相似。

它不使用项目依赖项,而是使用它们的源。使用目标copy-dependencies只是将源 jar 复制到目录或unpack-dependencies提取它们。请参阅下面的示例:

<project>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>3.3.0</version>
        <executions>
          <execution>
            <id>src-dependencies</id>
            <phase>package</phase>
            <goals>
              <!-- use copy-dependencies instead if you don't want to explode the sources -->
              <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
              <classifier>sources</classifier>
              <failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
              <outputDirectory>${project.build.directory}/sources</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  [...]
</project>