On Dec 17, 2008, at 3:33 AM, Martin Höller wrote:

  mvn -Pinstall4j package

Why would you have to use a profile for this?

Because it takes five minutes to run. I don't want to wait five minutes every time I package, install, or deploy my code. The install4j stuff only needs to happen when we're ready to ship the final installer to the customer. Without profiles, I don't know how to exercise control over when this time-consuming process kicks off.

If you really want maven to do only _one_ specific thing (which is most of
the time not the common way) you can execute a single plugin goal by
specifying just this goal, e.g. "mvn deploy:deploy-file" or "mvn
antrun:run".

No, specifying a single goal does not run a single goal, it runs ALL of the configurations for that goal. I've attached a sample POM to demonstrate. Try this:

  mvn antrun:run package

You will see both of the antrun:run configurations run.

In that same POM, I've also shown how to run just one of the configurations using profiles. For example:

  mvn -Phello package
  mvn -Pgoodbye package

Is there a way to achieve that without profiles?

Trevor

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.vocaro</groupId>
    <artifactId>antrun</artifactId>
    <version>1.0</version>
    <packaging>pom</packaging>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>say-hello</id>
                        <phase>package</phase>
                        <configuration>
                            <tasks>
                                <echo>hello</echo>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>say-goodbye</id>
                        <phase>package</phase>
                        <configuration>
                            <tasks>
                                <echo>goodbye</echo>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    
    <profiles>
        <profile>
            <id>hello</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>say-hello</id>
                                <phase>package</phase>
                                <configuration>
                                    <tasks>
                                        <echo>hello (profile)</echo>
                                    </tasks>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>goodbye</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>say-goodbye</id>
                                <phase>package</phase>
                                <configuration>
                                    <tasks>
                                        <echo>goodbye (profile)</echo>
                                    </tasks>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to