Friday, January 11, 2013

More Maven

Phases

Goals 

Goal are defined in each plugin.

  • From the packaging selected, goals are bind to phases by default.
  • By Configure plugins in your project, you can bind goals to phases. These goals will be added to the goals already bound to the phases from the packaging selected.


Shortened plugin prefix is done automatically if the artifactId follows the convention of using ${prefix}-maven-plugin (or maven-${prefix}-plugin if the plugin is part of the Apache Maven project). For example maven-surefire-plugin, you can refer to it as mvn surefire:${goal}

Profiles


A profile can be triggered/activated in several ways:
  • Explicitly
  • Through Maven settings
  • Based on environment variables
  • OS settings
  • Present or missing files
  • To activate a profile based on environment variables


<profiles>
  <profile>
    <activation>
      <property>
        <name>environment</name>
        <value>test</value>
      </property>
    </activation>
    ...
  </profile>
</profiles>

           To activate this, you would type this in command line

mvn groupId:artifactId:goal -Denvironment=test


  • Profiles can be explicitly specified using the -P CLI option.
mvn groupId:artifactId:goal -P profile1

No comments:

Post a Comment