You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Krull, Stephan" <St...@ecg-leipzig.de> on 2011/08/23 18:42:52 UTC

MavenProject / POM change in a command chain

Hello there,
 
I am currently working on a maven command chain to fulfill several tasks in one step on a maven project. the chain has the following syntax:
 
"../apache-maven-2.2.1/bin/mvn clean versions:use-parent-release scm:checkin install"
 
Explanation: The command chain starts by changing the version number of the parent artifact in the POM file to a corresponding release version (i.e. if I declare "<version>1.0.0-SNAPSHOT</version" in the parent section of the POM this will be transformed to "<version>1.0.0</version>"). After this change maven is going to commit these changes to the source code management. Thereafter I want maven to install the project with the new parent version number.
 
The problem: Changing and committing the change runs perfectly but at the installation step maven is working with the old parent version. My guess is that although the file (pom.xml) has already changed in the filesystem, maven still holds the "org.apache.maven.project.MavenProject" object which at instantiation time got the POM information before transformation. That is a problem because I do not see a way to change the POM file and call install (or deploy) on that currently changed project configuration in one maven call.
 
Does anybody have a clue how to get around this problem? I have been looking around to special annotations for the mojo to call but have not been lucky. Maybe there is a (hidden) plugin that is able to inject a reloaded MavenProject object into the reactor.
 
Appreciate your time reading this.
 
Regards
 
Stephan Krull
 

 

 

ECG Erdgas-Consult GmbH
Föpplstraße 3

04347 Leipzig / Germany
+49 341 443-1583 (phone)
+49 341 443-1855 (fax)

mailto: stephan.krull@ecg-leipzig.de <ma...@ecg-leipzig.de> 
Internet: www.ecg-leipzig.de <http://www.ecg-leipzig.de/> 

__________________________________________________ 


ECG Erdgas-Consult GmbH
Föpplstraße 3
04347 Leipzig / Germany

Court of Register: Local Court of Leipzig HRB 16467
Chief Executive Officer: Dr. Peter Heine, Klaus-Dieter Görlich
________________________________________________

 


Re: MavenProject / POM change in a command chain

Posted by Ansgar Konermann <an...@googlemail.com>.
Am 23.08.2011 18:43 schrieb "Krull, Stephan" <St...@ecg-leipzig.de>:
>
> Hello there,
>
> I am currently working on a maven command chain to fulfill several tasks
in one step on a maven project. the chain has the following syntax:
>
> "../apache-maven-2.2.1/bin/mvn clean versions:use-parent-release
scm:checkin install"
>
> Explanation: The command chain starts by changing the version number of
the parent artifact in the POM file to a corresponding release version (i.e.
if I declare "<version>1.0.0-SNAPSHOT</version" in the parent section of the
POM this will be transformed to "<version>1.0.0</version>"). After this
change maven is going to commit these changes to the source code management.
Thereafter I want maven to install the project with the new parent version
number.
>
> The problem: Changing and committing the change runs perfectly but at the
installation step maven is working with the old parent version. My guess is
that although the file (pom.xml) has already changed in the filesystem,
maven still holds the "org.apache.maven.project.MavenProject" object which
at instantiation time got the POM information before transformation. That is
a problem because I do not see a way to change the POM file and call install
(or deploy) on that currently changed project configuration in one maven
call.

Why is this a problem in your use case? I. e. why can't you use multiple
invocations of maven?

Best regards,

Ansgar

>
> Does anybody have a clue how to get around this problem? I have been
looking around to special annotations for the mojo to call but have not been
lucky. Maybe there is a (hidden) plugin that is able to inject a reloaded
MavenProject object into the reactor.
>
> Appreciate your time reading this.
>
> Regards
>
> Stephan Krull
>
>
>
>
>
>
> ECG Erdgas-Consult GmbH
> Föpplstraße 3
>
> 04347 Leipzig / Germany
> +49 341 443-1583 (phone)
> +49 341 443-1855 (fax)
>
> mailto: stephan.krull@ecg-leipzig.de <ma...@ecg-leipzig.de>
> Internet: www.ecg-leipzig.de <http://www.ecg-leipzig.de/>
>
> __________________________________________________
>
>
> ECG Erdgas-Consult GmbH
> Föpplstraße 3
> 04347 Leipzig / Germany
>
> Court of Register: Local Court of Leipzig HRB 16467
> Chief Executive Officer: Dr. Peter Heine, Klaus-Dieter Görlich
> ________________________________________________
>
>
>

Re: MavenProject / POM change in a command chain

Posted by Stephen Connolly <st...@gmail.com>.
There is no support for reloading the pom during a maven invocation.

This is why the versions plugin _clearly_ states that you cannot use
it with anything else from the same maven invocation.

On 23 August 2011 17:42, Krull, Stephan <St...@ecg-leipzig.de> wrote:
> Hello there,
>
> I am currently working on a maven command chain to fulfill several tasks in one step on a maven project. the chain has the following syntax:
>
> "../apache-maven-2.2.1/bin/mvn clean versions:use-parent-release scm:checkin install"
>
> Explanation: The command chain starts by changing the version number of the parent artifact in the POM file to a corresponding release version (i.e. if I declare "<version>1.0.0-SNAPSHOT</version" in the parent section of the POM this will be transformed to "<version>1.0.0</version>"). After this change maven is going to commit these changes to the source code management. Thereafter I want maven to install the project with the new parent version number.
>
> The problem: Changing and committing the change runs perfectly but at the installation step maven is working with the old parent version. My guess is that although the file (pom.xml) has already changed in the filesystem, maven still holds the "org.apache.maven.project.MavenProject" object which at instantiation time got the POM information before transformation. That is a problem because I do not see a way to change the POM file and call install (or deploy) on that currently changed project configuration in one maven call.
>
> Does anybody have a clue how to get around this problem? I have been looking around to special annotations for the mojo to call but have not been lucky. Maybe there is a (hidden) plugin that is able to inject a reloaded MavenProject object into the reactor.
>
> Appreciate your time reading this.
>
> Regards
>
> Stephan Krull
>
>
>
>
>
>
> ECG Erdgas-Consult GmbH
> Föpplstraße 3
>
> 04347 Leipzig / Germany
> +49 341 443-1583 (phone)
> +49 341 443-1855 (fax)
>
> mailto: stephan.krull@ecg-leipzig.de <ma...@ecg-leipzig.de>
> Internet: www.ecg-leipzig.de <http://www.ecg-leipzig.de/>
>
> __________________________________________________
>
>
> ECG Erdgas-Consult GmbH
> Föpplstraße 3
> 04347 Leipzig / Germany
>
> Court of Register: Local Court of Leipzig HRB 16467
> Chief Executive Officer: Dr. Peter Heine, Klaus-Dieter Görlich
> ________________________________________________
>
>
>
>

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