I’m using Maven 3.1.1 on Mac 10.9.1. I want to activate a profile based on whether certain child modules contain a file. I have tried the following

    <profile>
        <id>deploy-war-to-jboss</id>
        <activation>
            <file>
                <exists>${session.executionRootDirectory}/src/main/webapp/WEB-INF/web.xml</exists>
            </file>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.jboss.as.plugins</groupId>
                    <artifactId>jboss-as-maven-plugin</artifactId>
                    <version>${jboss.maven.plugin.version}</version>
                    <configuration>
                        <hostname>${jboss.remote.hostname}</hostname>
                        <port>${jboss.remote.port}</port>
                    </configuration>
                    <executions>
                        <execution>
                            <id>deploy-to-jboss</id>
                            <phase>install</phase>
                            <goals>
                                <goal>deploy</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>

but this profile doesn’t get activated when running “mvm clean install” despite the fact I’ve verified that the child modules in question contain the file. I also tried ${project.basedir} without luck. Any ideas how I make this happen?

有帮助吗?

解决方案

Since you define the profile in the parent POM (I guess) you should try this

${basedir}/name-of-your-child-module//src/main/webapp/WEB-INF/web.xml

Furthermore, you should try running Maven in debug mode to get more information at runtime:

mvm -X clean install
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top