如何省略" src / main / java" Maven构建的文件夹?

时间:2014-05-02 07:54:39

标签: maven maven-war-plugin

我有一个项目,我在src/main/webapp/..中有我的HTML和JavaScript文件。但是在同一个项目中,.java中有src/main/java folder个文件。但是,当我构建项目时,我根本不想使用这些java文件。它们是破碎的文件,用作其他目的的骨架。我有一个pom如下。

<artifactId>maven-war-plugin</artifactId>
<configuration>
  <failOnMissingWebXml>false</failOnMissingWebXml>
  <source>1.7</source>
  <target>1.7</target>
  <warSourceExcludes>src/main/java/**</warSourceExcludes>
</configuration>

但我仍然得到与java代码相关的错误。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

我为此问题创建了一种解决方法。

 <build>
    <finalName>${project.artifactId}</finalName>
    <!--  Here we point to an empty folder, so the maven will not complain about broken java codes -->
    <sourceDirectory>src/main/javaempty</sourceDirectory>
    <plugins>

现在maven正在编译javaempty文件夹而没有任何抱怨:)

相关问题