Hello,

I did a experiment regarding when maven executes the plug-in in an active
profile. I define a profile at the top of pom.xml as belows:

<profiles>
<profile>
<id>PrepareTestEnv</id>
      <activation>
        <property>
          <name>!maven.test.skip</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>EchoProfileID</id>
                <phase>test-compile</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <tasks>
                    <echo>XXXXX = PrepareTestEnv profile is active</echo>
                  </tasks>
        ...
</profiles>

<build>
<plugins>
<plugin>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>Echo</id>
                <phase>test-compile</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <tasks>
                    <echo>XXXXX = I'm in default profile</echo>
                  </tasks>
        ...
</build>

When I run "mvn", it prints out "XXXXX = I'm in default profile" and then
"XXXXX =  PrepareTestEnv profile is active". it seems to me that maven
always executes the plugin in profile AFTER the plugin in default profile
regardless where the profile is defined. Is it by design?

Thanks
Yan

Reply via email to