Re: Hooks on mvn release:prepare

2019-11-29 Thread Enrico Olivelli
Hello,
this is my final working example, it is using preparationGoals and
completionGoals in order to alter files and the commit them.

https://github.com/eolivelli/testreleaseplugin

@Stephen Connolly  I confirm you that a
'git commit' is really needed, "git add" is not enough, but using the Maven
SCM Plugin it very easy.

I feel that the Maven Release Plugin has already got all that is needed.

I will apply this practice to some real project then I will update the
Maven Release Plugin documentation with this example

Thank you so much !
Enrico

Il giorno sab 23 nov 2019 alle ore 17:32 Stephen Connolly <
stephen.alan.conno...@gmail.com> ha scritto:

> On Sat 23 Nov 2019 at 14:53, Enrico Olivelli  wrote:
>
> > Stephen
> >
> > Il sab 2 nov 2019, 11:00 Stephen Connolly <
> stephen.alan.conno...@gmail.com
> > >
> > ha scritto:
> >
> > > On Thu 3 Oct 2019 at 16:13, Enrico Olivelli 
> wrote:
> > >
> > > > Hello,
> > > > I am going to propose a new release procedure in Apache ZooKeeper
> > project
> > > > in the direction of using the Maven Release Plugin.
> > > > Usually with the Maven Release Plugin you are performing to tasks:
> > > >
> > > > mvn release:prepare -> change version + create tag
> > > > mvn release:perform  -> create final artifacts and deploy
> > > >
> > > > in the specific case of Apache ZooKeeper we have a C-client that
> > > contains
> > > > C sources under a mavenized project, so in src/c or something like
> > that,
> > > > not so important.
> > > >
> > > > The important fact is that I have the 'version' in pom.xml and in
> the C
> > > > client (make/configure based build).
> > > > I would like to introduce an hook that during "release:prepare" while
> > > > changing the version in all of the pom.xml files it changes the
> version
> > > > inside the C project.
> > > > I just need a way to invoke a bash script with a 'sed' command that
> has
> > > the
> > > > new VERSION variable in a shell environment.
> > > > I can also write some java code or whatever else
> > > >
> > > > But I need some "hook" during release:prepare.
> > > >
> > > > I can't find any documentation about this feature other then
> > > > "prepationGoals" but it is not documented and there is no good
> example
> > on
> > > > the Internet
> > > >
> > > >
> > >
> >
> https://maven.apache.org/maven-release/maven-release-plugin/examples/run-goals-before-commit.html
> > > >
> > > > Any idea or working example ?
> > >
> > >
> > > So if you are using GIT as your SCM, as long as you do `git add
> > > name-of-file` after changing the file inside preparationGoals then it
> > will
> > > get committed with the pom.xml changes.
> > >
> >
> >
> > This approach actually works
> > This is a sample project
> > https://gitbub.com/eolivelli/testreleaseplugin
> >
> > The only remaining problem is the 'preparationGoals' come into play only
> > while preparing the release and not while bumping the version to the new
> > one
>
>
> I believe I added completionGoals for that purpose :-D
>
>
> >
> >
> > Thank you
> >
> > Enrico
> >
> >
> > > A bit hacky, but works. My only use of it is closed source so cannot
> > share
> > >
> > >
> > > >
> > > > Thanks
> > > > Enrico
> > > >
> > > --
> > > Sent from my phone
> > >
> >
> --
> Sent from my phone
>


Overriding plugin parameters via commandline

2019-11-29 Thread Marco Herrn
Hi,

if I try to call the following maven goal:

  mvn kilt:reformat -Dformat=" = \n"

the parameter `format` is correctly set to the given value for the `reformat` 
goal of the `kilt-maven-plugin`.

However, if I specify this parameter also in the pom.xml:

  
de.poiu.kilt
kilt-maven-plugin
0.4.0-SNAPSHOT

  \t: \n

  

the value given in the pom.xml always takes precedence. The cmdline parameter 
is ignored in that case.

What do I have to do to be able to override the values in the configuration? Do 
I need to specify the parameter in the ReformatMojo of the kilt-maven-plugin 
differently? It is currently specified as:

  @Parameter(property="format", defaultValue = " = \\n", required = 
true)
  private String format;

Do I need to specify something differently to override a configation setting in 
the pom.xml via commandline flags?

In case you are curios, I am talking about that plugin: 
https://github.com/hupfdule/kilt/tree/master/kilt-maven-plugin

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



Re: Overriding plugin configuration via commandline

2019-11-29 Thread Bernd Eckenfels
yes user properties for plugins only work for default values. If you want to  
allow overwrite, you need to define the default as a property and overwrite it 
with system property or in a profile and the use the property in the plugin 
config.

Be aware that it is a good thing if a Pom without external config can be used 
for reproducebable builds, I would therefore use it only for limited cases.

Gruss
Bernd


--
http://bernd.eckenfels.net


Von: m...@mherrn.de
Gesendet: Freitag, November 29, 2019 10:00 PM
An: users@maven.apache.org
Betreff: Overriding plugin configuration via commandline

Hi,

When I specify a property for a plugins goal on the command line, like:

mvn kilt:reformat -Dformat=" = \n"

this works as expected, as long as this property (in this case "format")
isn't set in the pom for that plugin. Otherwise the configuration in the
pom.xml apparently takes precedence before the parameter that is given on
the command line. I would expect it the other way around.

This is the definition of the above mentioned property in the ReformatMojo:

@Parameter(property="format", defaultValue = " = \\n",
required = true)
private String format;

Do I need to configure something differently in the Mojo to be able to
override settings that are already set in the pom.xml?


(If someone is curios: the above mentioned plugin is this one:
https://github.com/hupfdule/kilt/tree/master/kilt-maven-plugin)


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



Overriding plugin configuration via commandline

2019-11-29 Thread ml
Hi,

When I specify a property for a plugins goal on the command line, like:

   mvn kilt:reformat -Dformat=" = \n"

this works as expected, as long as this property (in this case "format")
isn't set in the pom for that plugin. Otherwise the configuration in the
pom.xml apparently takes precedence before the parameter that is given on
the command line. I would expect it the other way around.

This is the definition of the above mentioned property in the ReformatMojo:

  @Parameter(property="format", defaultValue = " = \\n",
required = true)
  private String format;

Do I need to configure something differently in the Mojo to be able to
override settings that are already set in the pom.xml?


(If someone is curios: the above mentioned plugin is this one:
https://github.com/hupfdule/kilt/tree/master/kilt-maven-plugin)


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