Maven:在编译中排除Java文件 [英] Maven: excluding java files in compilation

查看:86
本文介绍了Maven:在编译中排除Java文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Java源文件夹,希望将其从编译中排除.

I have a folder of java sources which I wish to exclude from the compilation.

我的文件夹在qa/apitests/src/main/java/api/test/omi下.

我在qa/bamtests下的pom.xml中添加了以下条目,但没有帮助.我还需要输入一个条目吗?

I added the following entry in the pom.xml under qa/bamtests but it didn't help. Is there an entry in addition I need to make?

   <build>
     <resources>
       <resource>
         <directory>src/main/java</directory>
         <includes>
           <include>**/*.properties</include>
           <include>**/*.xml</include>
           <include>**/*.xsd</include>
           <include>**/*.csv</include>
         </includes>
         <excludes>
<exclude>src/main/java/api/test/omi</exclude>
         </excludes>
       </resource>
</build>

推荐答案

使用 Maven编译器插件.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <configuration>
    <excludes>
      <exclude>**/api/test/omi/*.java</exclude>
    </excludes>
  </configuration>
</plugin>

这篇关于Maven:在编译中排除Java文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆