小编Nag*_*ila的帖子

Maven project.build.testSourceDirectory属性不适用于配置文件

我想在maven项目中测试不同的文件夹,我需要更改maven的project.build.testSourceDirectory属性.

我正在使用maven配置文件来解决这个问题.

我的个人资料如下:

<profiles>
    <profile>
        <id>sahi_UI_testing</id>
        <activation>
            <property>
                <name>sahiTesting</name>
                <value>true</value>
            </property>
        </activation>
        <properties>
            <maven.test.skip>false</maven.test.skip>
            <project.build.testSourceDirectory>src/test/java/org/package1/package2/sahi</project.build.testSourceDirectory>
        </properties>
    </profile>
</profiles>
Run Code Online (Sandbox Code Playgroud)

project.build.testSourceDirectory不会改变,只是保持默认/home/username/workspace/projectName/core/src/test/java(我已经测试这maven-antrun-plugin并给出路径).
我在项目中有多个pom.xml,所以在路径中我有../core/ ..文件夹(这是项目的核心pom.xml).


maven-antrun-plugin:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.1</version>
    <executions>
        <execution>
            <phase>validate</phase>
            <goals>
                <goal>run</goal>
            </goals>
            <configuration>
                <tasks>
                    <echo>******** Displaying value of property ********</echo>
                    <echo>${project.build.testSourceDirectory}</echo>
                    <echo>${maven.test.skip}</echo>
                </tasks>
            </configuration>
        </execution>
    </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)


执行mvn help:active-profiles -f core/pom.xml -Dtest=JavaClientTest -o -e test -DsahiTesting=true<maven.test.skip>true</maven.test.skip>maven-antrun-plugin这给了我:
[INFO]执行任务
[回音] **显示的属性值**
[回音] /首页/用户名/工作区/项目名称/核心/ src目录/ …

pom.xml maven

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

maven ×1

pom.xml ×1