You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Oliver B. Fischer" <o....@swe-blog.net> on 2018/06/12 15:20:55 UTC

When does a Maven plugin uses the POM in the current directory?

Dear all,

I use the Versions Maven Plugin to check for updates of my dependencies. 
Therefore I added the following lines to my pom.xml:

<plugin>
     <groupId>org.codehaus.mojo</groupId>
     <artifactId>versions-maven-plugin</artifactId>
     <version>${versions-plugin.version}</version>
     <configuration>
         <rulesUri>classpath:///rules.xml</rulesUri>
     </configuration>
     <dependencies>
         <dependency>
             <groupId>versionrules</groupId>
             <artifactId>versionrules</artifactId>
             <version>1-SNAPSHOT</version>
         </dependency>
     </dependencies>
</plugin>

But this configuration is not used if I run the Versions Maven Plugin in 
the same directory as the pom.xml. The only way to my own configuration 
is to put this plugin configuration in a profil and execute this profil 
during the Maven run.

Is there a way to run the Versions plugin on the commandline and to 
configure it via the pom.xml?

Bye,

Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: When does a Maven plugin uses the POM in the current directory?

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi,

you can do that in different flavours..

by using an execution id like `default-cli` this will be used during the 
execution on command line (using the current configuration) furthermore 
since Maven 3.3.1 you can use things like[1]:

mvn version:set@Id

which means you can do a different configuration for command line in the 
pom file:

Just by simply separating them by different id

  <build>
     <plugins>
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>versions-maven-plugin</artifactId>
         <version>2.5.</version>
         <executions>
           <execution>
             <id>default-cli</id>
             <configuration>
               ...
             </configuration>
           </execution>
           <execution>
             <id>second-cli</id>
             <configuration>
                ....
             </configuration>
           </execution>
         </executions>
       </plugin>
     </plugins>
   </build>



[1]: https://maven.apache.org/docs/3.3.1/release-notes.html

On 13/06/18 08:08, Anders Hammar wrote:
> If you put the configuration of the plugin within the pluginManagement
> section of the pom, it will be used if you execute the plugin from command
> line.
> 
> /Anders
> 
> On Tue, Jun 12, 2018 at 5:21 PM Oliver B. Fischer <o....@swe-blog.net>
> wrote:
> 
>> Dear all,
>>
>> I use the Versions Maven Plugin to check for updates of my dependencies.
>> Therefore I added the following lines to my pom.xml:
>>
>> <plugin>
>>       <groupId>org.codehaus.mojo</groupId>
>>       <artifactId>versions-maven-plugin</artifactId>
>>       <version>${versions-plugin.version}</version>
>>       <configuration>
>>           <rulesUri>classpath:///rules.xml</rulesUri>
>>       </configuration>
>>       <dependencies>
>>           <dependency>
>>               <groupId>versionrules</groupId>
>>               <artifactId>versionrules</artifactId>
>>               <version>1-SNAPSHOT</version>
>>           </dependency>
>>       </dependencies>
>> </plugin>
>>
>> But this configuration is not used if I run the Versions Maven Plugin in
>> the same directory as the pom.xml. The only way to my own configuration
>> is to put this plugin configuration in a profil and execute this profil
>> during the Maven run.
>>
>> Is there a way to run the Versions plugin on the commandline and to
>> configure it via the pom.xml?
>>
>> Bye,
>>
>> Oliver
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: When does a Maven plugin uses the POM in the current directory?

Posted by Anders Hammar <an...@hammar.net>.
If you put the configuration of the plugin within the pluginManagement
section of the pom, it will be used if you execute the plugin from command
line.

/Anders

On Tue, Jun 12, 2018 at 5:21 PM Oliver B. Fischer <o....@swe-blog.net>
wrote:

> Dear all,
>
> I use the Versions Maven Plugin to check for updates of my dependencies.
> Therefore I added the following lines to my pom.xml:
>
> <plugin>
>      <groupId>org.codehaus.mojo</groupId>
>      <artifactId>versions-maven-plugin</artifactId>
>      <version>${versions-plugin.version}</version>
>      <configuration>
>          <rulesUri>classpath:///rules.xml</rulesUri>
>      </configuration>
>      <dependencies>
>          <dependency>
>              <groupId>versionrules</groupId>
>              <artifactId>versionrules</artifactId>
>              <version>1-SNAPSHOT</version>
>          </dependency>
>      </dependencies>
> </plugin>
>
> But this configuration is not used if I run the Versions Maven Plugin in
> the same directory as the pom.xml. The only way to my own configuration
> is to put this plugin configuration in a profil and execute this profil
> during the Maven run.
>
> Is there a way to run the Versions plugin on the commandline and to
> configure it via the pom.xml?
>
> Bye,
>
> Oliver
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: When does a Maven plugin uses the POM in the current directory?

Posted by "Oliver B. Fischer" <o....@swe-blog.net>.
Thank you all for your support. Now it works as I need it.

Am 12.06.18 um 17:20 schrieb Oliver B. Fischer:
> Dear all,
> 
> I use the Versions Maven Plugin to check for updates of my dependencies. 
> Therefore I added the following lines to my pom.xml:
> 
> <plugin>
>      <groupId>org.codehaus.mojo</groupId>
>      <artifactId>versions-maven-plugin</artifactId>
>      <version>${versions-plugin.version}</version>
>      <configuration>
>          <rulesUri>classpath:///rules.xml</rulesUri>
>      </configuration>
>      <dependencies>
>          <dependency>
>              <groupId>versionrules</groupId>
>              <artifactId>versionrules</artifactId>
>              <version>1-SNAPSHOT</version>
>          </dependency>
>      </dependencies>
> </plugin>
> 
> But this configuration is not used if I run the Versions Maven Plugin in 
> the same directory as the pom.xml. The only way to my own configuration 
> is to put this plugin configuration in a profil and execute this profil 
> during the Maven run.
> 
> Is there a way to run the Versions plugin on the commandline and to 
> configure it via the pom.xml?
> 
> Bye,
> 
> Oliver
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org