使用项目依赖的来源
它不使用项目依赖项,而是使用它们的源。使用目标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>