2

我的项目必须使用 JAVA 1.3 构建,所以我使用以下编译插件:

<plugin>
    <inherited>true</inherited>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
    <executions>
        <execution>
            <phase>compile</phase>
            <goals>
                <goal>compile</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <source>1.3</source>
        <target>1.3</target>
    </configuration>
</plugin>

. 但是,在构建期间,我需要执行 JUNIT4 测试,因此我需要 sunfire 插件才能使用 java 1.6。这在maven 3中可能吗?

4

2 回答 2

3

将您的插件配置更改为以下内容:

<plugin>
    <inherited>true</inherited>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
    <executions>
        <execution>
            <id>default-compile</id>
            <phase>compile</phase>
            <goals>
                <goal>compile</goal>
            </goals>
            <configuration>
                <source>1.3</source>
                <target>1.3</target>
            </configuration>
        </execution>
        <execution>
            <id>default-testCompile</id>
            <phase>test-compile</phase>
            <goals>
                <goal>testCompile</goal>
            </goals>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </execution>
    </executions>
</plugin>
于 2012-11-05T12:45:32.477 回答
2

检查surefire插件及其属性“jvm”

http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html

于 2012-11-05T12:39:19.963 回答