dex*_*deb 1 toggle maven-compiler-plugin spring-boot spring-boot-maven-plugin
我需要在运行 Maven 构建时排除某些 Java 源文件作为最终构建的一部分进行编译。
我在基于 Spring Boot 的项目中使用 Spring Boot Maven 插件。
我正在寻找一种从编译中排除 Java 源文件的方法,并且在构建时也需要从最终构建中排除相应的 Junit 测试类。
有没有办法使用 Spring Boot Maven 插件实现相同的目标?
我通过配置 maven-compiler-plugin 实现了这一点:
pom.xml
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<excludes>
<exclude>com/example/compileexclude/ExcludedJavaClass.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
...
Run Code Online (Sandbox Code Playgroud)
作为参考,您可以在此处查看所有可用的配置选项。
| 归档时间: |
|
| 查看次数: |
3660 次 |
| 最近记录: |