【问题标题】:How to override configuration of maven-compiler-plugin. (build directory, I want to change by using profile)如何覆盖 maven-compiler-plugin 的配置。 (构建目录,我想使用配置文件进行更改)
【发布时间】:2011-07-09 19:45:42
【问题描述】:

我想通过使用 maven 的配置文件来忽略特定目录中的一些构建错误。我试图像下面那样做,但没有奏效。任何帮助将不胜感激?

============================================
[executed command]

mvn -P test clean compile

============================================
[part of pom.xml]

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.5</source>
                <target>1.5</target>
                <showWarnings>true</showWarnings>
            </configuration>
        </plugin>
    </plugins>
</build>
<profiles>
    <profile>
        <id>test</id>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.5</source>
                        <target>1.5</target>
                    </configuration>
                    <executions>
                        <execution>
                            <id>default-compile</id>
                            <configuration>
                                <excludes>
                                    <exclude>**/nocompile/*</exclude>
                                </excludes>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

============================================
[a class happened a build error]

package com.sample.web.nocompile;

public class NoCompileSample {

    // An error do happen here 
    private String

}

【问题讨论】:

    标签: java maven-2 maven maven-plugin


    【解决方案1】:

    您的个人资料看起来不错。不过,maven 编译器似乎存在一个已知问题。有关问题的描述和解决方法,请参阅 this answer 到类似问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-07-04
      • 2016-10-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-18
      • 2021-08-20
      相关资源
      最近更新 更多