Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven plugin execution ID

Tags:

java

maven

gwt

I have a simple question about execution ID in maven plugin.

    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
    <version>2.7.0</version>
    <executions>
    <execution>
        <id>gwt-process-resources</id>
        <goals>
            <goal>i18n</goal>
            <goal>generateAsync</goal>
        </goals>
    </execution>
</executions>

Can someone explain to me what does this executionId does? How are goals triggered? Can I call directly the "gwt-process-resources" in order to execute both goals? If yes, how can I do that?

like image 378
Florian Avatar asked Oct 22 '15 10:10

Florian


People also ask

What is an execution ID?

An Execution Id is a valid user ID that is used to connect to the Reporting Server, FTP server or web server to run a schedule task. When an Execution Id is created, changed, or deleted on a server, it must also be created, changed, or deleted in the Repository table that stores Execution Id credentials.

What is execution in Maven plugin?

Maven exec plugin allows us to execute system and Java programs from the maven command. There are two goals of the maven exec plugin: exec:exec - can be used to execute any program in a separate process. exec:java - can be used to run a Java program in the same VM.

What is ID in Maven?

The id element has two functions: Documentation. Allow Maven to know when you want to create a new execution and when you want to modify an existing one.

What is the difference between plugin and pluginManagement tags?

pluginManagement: is an element that is seen along side plugins. Plugin Management contains plugin elements in much the same way, except that rather than configuring plugin information for this particular project build, it is intended to configure project builds that inherit from this one.


2 Answers

<id></id> exists only for you to be able to distinguish between other executions. This tag will be displayed when you do the actual build.

Your execution example will invoke the two goals you have specified: i18n and generateAsync.

If the plugin isn't bound to a specific phase (process-resources, package, install, etc) your execution will not performed. The plugin's documentation should tell if this is the case.

You can specify/override the default phase by using the <phase> tag:

...
<execution>
  <id>gwt-process-resources</id>
  <phase>process-resources</phase> <!-- If you need to override -->
  <goals>
    <goal>i18n</goal>
    <goal>generateAsync</goal>
  </goals>
</execution>
...

...

Goals are either triggered:

  • Automatically (implicitly by their default phase or explicitly as above)
  • By command line execution: mvn <plugin name>:<goal>
like image 52
Daniel Avatar answered Oct 25 '22 02:10

Daniel


Here is a very simple explanation:

You can not call excecution ids directly

  mvn gwt-process-resources

will not work since gwt-process-resources is just an id.

If there is no <phase> declaration in the pom then you might want to look at the documentation of the plugin and find the corresponding default phase. If you look at the documentation of the gwt plugin:

  • gwt:i18n Binds by default to generate-sources.
  • gwt:generateAsync Binds by default to the lifecycle phase: generate-sources.

How are goals triggered?

if you do

mvn compile

=> compile > generate-sources in maven lifecycle
=> maven execute gwt:i18n after gwt:generateAsync
=> executed in the order they are declared in pom.xml because they are bound to some phase "generate-sources"

like image 25
question_maven_com Avatar answered Oct 25 '22 01:10

question_maven_com