使用source:jar目标,如何配置它以使target/generated-sources文件夹从存档中排除?我已经尝试了许多不同的配置,并且无法使它们中的任何一个工作.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<excludes>
<exclude>target/generated-sources</exclude>
</excludes>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我已经在exlude标签中尝试了各种各样的东西target/generated-sources/**/*.java,com/mycompany/**/*.java因为我变得非常确信它甚至没有看到它,只是尝试过*.java,似乎没有被排除在外.
这是Maven 3.0.5和源代码2.2.1.我是从Maven CLI运行的.以下是感兴趣的人的完整POM.
<?xml version="1.0" encoding="utf-8" ?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>foo-service</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.8</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
<configuration>
<packageName>com.example</packageName>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<excludes>
<exclude>target/generated-sources</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
希望你能明白这一点——但它的价值是什么。此配置可排除 com.foo.server 包中的任何内容,并且不包含目标文件夹。由于它是相对于 src/com 目录运行的,因此您的问题可能是您的项目配置为将生成的源放在错误的目录中。/target 应该位于 /src 文件夹旁边,该文件夹不会包含在源插件中,因为它将从 /src/main/java/ 开始
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<configuration>
<excludes>
<exclude>com/foo/server/**</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2025 次 |
| 最近记录: |