Issue reading configuration from exection

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue reading configuration from exection

Kev James
Hi all,
Is this the right place to ask questions about writing Maven plugins? I'm
writing a plugin and I have a unit test that tries to verify that the
<configuration> in an <execution> is being read (because right now it
doesn't, so it's got its own unit test now).

This pom is read correctly, and my Mojo's execute() method has the
parameters set correctly:
..
..
<build>
<plugins>
<plugin>
<artifactId>p2composite-maven-plugin</artifactId>
<configuration>
<folder>target/test-classes/test5</folder>
<repositoryName>test5</repositoryName>
</configuration>
</plugin>
</plugins>
</build>

However, this pom fails because the  variables holding my parameters are
null in the execute() method:

..
..
<build>
  <plugins>
    <plugin>
      <artifactId>p2composite-maven-plugin</artifactId>
      <executions>
        <execution>
          <id>check-configuration-works-in-execution</id>
          <phase>deploy</phase>
          <goals>
            <goal>p2composite</goal>
          </goals>
          <configuration>
            <repositoryName>test6</repositoryName>
            <folder>target/test-classes/test6</folder>
          </configuration>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

Do I need to do something special? I'm happy to provide more information if
necessary, I figured I'd start brief and work up..

Cheers,
Kev.
Reply | Threaded
Open this post in threaded view
|

Re: Issue reading configuration from exection

Robert Scholte-8
On Mon, 06 Aug 2018 18:27:48 +0200, Kev James <[hidden email]>  
wrote:

> Hi all,
> Is this the right place to ask questions about writing Maven plugins? I'm
> writing a plugin and I have a unit test that tries to verify that the
> <configuration> in an <execution> is being read (because right now it
> doesn't, so it's got its own unit test now).
>
> This pom is read correctly, and my Mojo's execute() method has the
> parameters set correctly:
> ..
> ..
> <build>
> <plugins>
> <plugin>
> <artifactId>p2composite-maven-plugin</artifactId>
> <configuration>
> <folder>target/test-classes/test5</folder>
> <repositoryName>test5</repositoryName>
> </configuration>
> </plugin>
> </plugins>
> </build>
>
> However, this pom fails because the  variables holding my parameters are
> null in the execute() method:
>
> ..
> ..
> <build>
>   <plugins>
>     <plugin>
>       <artifactId>p2composite-maven-plugin</artifactId>
>       <executions>
>         <execution>
>           <id>check-configuration-works-in-execution</id>
>           <phase>deploy</phase>
>           <goals>
>             <goal>p2composite</goal>
>           </goals>
>           <configuration>
>             <repositoryName>test6</repositoryName>
>             <folder>target/test-classes/test6</folder>
>           </configuration>
>         </execution>
>       </executions>
>     </plugin>
>   </plugins>
> </build>

If you run 'mvn deploy', this should work. However if you call  
p2composite:p2composite it doesn't, because the plugin is running without  
the execution block. Running it like  
p2composite:p2composite@check-configuration-works-in-execution should pick  
up the execution specific configuration.

thanks,
Robert

>
> Do I need to do something special? I'm happy to provide more information  
> if
> necessary, I figured I'd start brief and work up..
>
> Cheers,
> Kev.

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