You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Nils Breunese <ni...@breun.nl> on 2025/01/03 16:20:02 UTC
Specifying system properties on the command line
Hello,
I’m using jib-maven-plugin with some properties provided on the command line. According to https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin#system-properties this can be done as follows:
mvn compile jib:build -Djib.to.image=myregistry/myimage:latest
I’ve been successfully using the syntax above with Maven 3.9.9, but when I try this with Maven 4.0.0-rc-2 it seems that the ‘jib.to.image’ property is not picked up by jib-maven-plugin.
When I do this, it does work:
MAVEN_OPTS="-Djib.to.image=myregistry/myimage:latest” compile jib:build
Is this an intentional change between Maven 3 and 4? Is the jib-maven-plugin documentation incorrect, or at least for Maven 4?
I noticed that the jib-maven-plugin mentions that these are system properties, while the -D flag is for setting user properties, but according to Maven 3’s ‘mvn --help’ this was also already the case in Maven 3.
Nils.
Re: Specifying system properties on the command line
Posted by Nils Breunese <ni...@breun.nl>.
Thanks for confirming that this behavioral change was not intentional for Maven 4. I’ve tried it locally with a fresh build from master, but I had the same issue, so I’ve created a bug ticket: https://issues.apache.org/jira/browse/MNG-8486
Nils.
Tamás Cservenák <ta...@cservenak.net> wrote:
> Howdy,
>
> yes and no :)
>
> Historically, Maven3 was "pushing" Maven User Properties into Java
> System Properties, that was later picked up by Maven System properties
> (not to be mixed up with Java System properties, Maven one contains
> env. etc as well).
> It was a bit messy.
>
> We do want to clean up this, and stop pushing them into Java System
> properties, as this is one of the obstacles preventing multiple Mavens
> per single JVM:
>
> For example, see here:
> https://github.com/apache/maven/blob/0b7235c0942d5758692318919d5d34d6971f79d2/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvn/resident/ResidentMavenInvoker.java#L64-L69
>
> Today, mvnd holds a pool of "(resident) maven processes" for this
> exact reason, but somewhere in the future the new "resident maven"
> could itself become a pool as well, and even new mvnsh could make use
> of it as well...
>
> Still, this change was NOT planned for 4.0.0, so it is most probably a
> bug, please report it.
>
> Still, this should also be a "heads up" for plugin and extension devs,
> to NOT rely that users properties are also present in Java System
> properties, instead, they should use Maven session (is even more clear
> in Maven 4 API) to get them.
>
> Thanks
> T
>
> PS: rc-2 had some issues in this area, and the master may have already
> fixed this. Before reporting the issue, could you try with a master
> built Maven?
>
> On Fri, Jan 3, 2025 at 5:20 PM Nils Breunese <ni...@breun.nl> wrote:
>>
>> Hello,
>>
>> I’m using jib-maven-plugin with some properties provided on the command line. According to https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin#system-properties this can be done as follows:
>>
>> mvn compile jib:build -Djib.to.image=myregistry/myimage:latest
>>
>> I’ve been successfully using the syntax above with Maven 3.9.9, but when I try this with Maven 4.0.0-rc-2 it seems that the ‘jib.to.image’ property is not picked up by jib-maven-plugin.
>>
>> When I do this, it does work:
>>
>> MAVEN_OPTS="-Djib.to.image=myregistry/myimage:latest” compile jib:build
>>
>> Is this an intentional change between Maven 3 and 4? Is the jib-maven-plugin documentation incorrect, or at least for Maven 4?
>>
>> I noticed that the jib-maven-plugin mentions that these are system properties, while the -D flag is for setting user properties, but according to Maven 3’s ‘mvn --help’ this was also already the case in Maven 3.
>>
>> Nils.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
Re: Specifying system properties on the command line
Posted by Tamás Cservenák <ta...@cservenak.net>.
Howdy,
yes and no :)
Historically, Maven3 was "pushing" Maven User Properties into Java
System Properties, that was later picked up by Maven System properties
(not to be mixed up with Java System properties, Maven one contains
env. etc as well).
It was a bit messy.
We do want to clean up this, and stop pushing them into Java System
properties, as this is one of the obstacles preventing multiple Mavens
per single JVM:
For example, see here:
https://github.com/apache/maven/blob/0b7235c0942d5758692318919d5d34d6971f79d2/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvn/resident/ResidentMavenInvoker.java#L64-L69
Today, mvnd holds a pool of "(resident) maven processes" for this
exact reason, but somewhere in the future the new "resident maven"
could itself become a pool as well, and even new mvnsh could make use
of it as well...
Still, this change was NOT planned for 4.0.0, so it is most probably a
bug, please report it.
Still, this should also be a "heads up" for plugin and extension devs,
to NOT rely that users properties are also present in Java System
properties, instead, they should use Maven session (is even more clear
in Maven 4 API) to get them.
Thanks
T
PS: rc-2 had some issues in this area, and the master may have already
fixed this. Before reporting the issue, could you try with a master
built Maven?
On Fri, Jan 3, 2025 at 5:20 PM Nils Breunese <ni...@breun.nl> wrote:
>
> Hello,
>
> I’m using jib-maven-plugin with some properties provided on the command line. According to https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin#system-properties this can be done as follows:
>
> mvn compile jib:build -Djib.to.image=myregistry/myimage:latest
>
> I’ve been successfully using the syntax above with Maven 3.9.9, but when I try this with Maven 4.0.0-rc-2 it seems that the ‘jib.to.image’ property is not picked up by jib-maven-plugin.
>
> When I do this, it does work:
>
> MAVEN_OPTS="-Djib.to.image=myregistry/myimage:latest” compile jib:build
>
> Is this an intentional change between Maven 3 and 4? Is the jib-maven-plugin documentation incorrect, or at least for Maven 4?
>
> I noticed that the jib-maven-plugin mentions that these are system properties, while the -D flag is for setting user properties, but according to Maven 3’s ‘mvn --help’ this was also already the case in Maven 3.
>
> Nils.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org