You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Sverre Moe <sv...@gmail.com> on 2022/09/13 08:07:53 UTC

Maven Wrapper: Using it with override settings.xml

I have been looking into the Maven Wrapper. We have mostly been using
Gradle for new projects, but I was thinking of taking the Maven Wrapper in
use for our legacy projects that still use Maven.

With Gradle we can create a custom gradle distribution that has all common
settings and properties needed by projects built by gradle.

How can we do the same with Maven?

Now we have the files settings.xml and settings-security.xml stored in
~/.m2, which must be copied by all users into their own user home directory.

Running mvn wrapper:wrapper gave me this maven-wrapper.properties

distributionUrl=
https://nexus.company.com:8443/repository/maven-public//org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
wrapperUrl=
https://nexus.company.com:8443/repository/maven-public//org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar

Even though the Maven Wrapper is downloaded from our Nexus, the
dependencies are not, until I provide the settings.xml.

Re: Maven Wrapper: Using it with override settings.xml

Posted by Nils Breunese <ni...@breun.nl>.
I also use .mvn/maven.config with ‘--settings <path-to-settings-xml-in-project>`. It works, but only when you invoke the mvnw script from the root directory of the project, otherwise the path to the settings.xml file will be wrong. That’s a slightly annoying limitation.

There’s an open issue to improve this: https://issues.apache.org/jira/browse/MNG-5659

Nils.

> Op 13 sep. 2022, om 12:00 heeft Slawomir Jaranowski <s....@gmail.com> het volgende geschreven:
> 
> Hi,
> 
> You can create file: .mvn/maven.config [1] with content
> 
> --settings ./settings.xml
> 
> [1] https://maven.apache.org/configure.html#mvn-maven-config-file
> 
> wt., 13 wrz 2022 o 11:46 Delany <de...@gmail.com> napisał(a):
> 
>> I used to place them in <project>/.mvn/settings.xml but khmarbaise advised
>> against, so I inject the settings.xml file in via a Jenkins plugin
>> Delany
>> 
>> On Tue, 13 Sept 2022 at 11:33, Sverre Moe <sv...@gmail.com> wrote:
>> 
>>> But I still need to provide the settings.xml on all servers, and to all
>>> users from somewhere.
>>> Is there any way to repackage the maven distribution to include our
>>> settings.xml like we do for the Gradle distribution?
>>> 
>>> It would help if we could refer to an URL and not file. However then all
>>> who use the Maven Wrapper need to write a very long command line.
>>> ./mvnw --settings
>>> https://nexus.company.com:8443/repository/java/maven/settings.xml clean
>>> install
>>> 
>>> tir. 13. sep. 2022 kl. 10:16 skrev Mantas Gridinas <mgridinas@gmail.com
>>> :
>>> 
>>>> You can override which settings file is used with --settings flag.
>>>> 
>>>> On Tue, Sep 13, 2022, 11:08 Sverre Moe <sv...@gmail.com> wrote:
>>>> 
>>>>> I have been looking into the Maven Wrapper. We have mostly been using
>>>>> Gradle for new projects, but I was thinking of taking the Maven
>> Wrapper
>>>> in
>>>>> use for our legacy projects that still use Maven.
>>>>> 
>>>>> With Gradle we can create a custom gradle distribution that has all
>>>> common
>>>>> settings and properties needed by projects built by gradle.
>>>>> 
>>>>> How can we do the same with Maven?
>>>>> 
>>>>> Now we have the files settings.xml and settings-security.xml stored
>> in
>>>>> ~/.m2, which must be copied by all users into their own user home
>>>>> directory.
>>>>> 
>>>>> Running mvn wrapper:wrapper gave me this maven-wrapper.properties
>>>>> 
>>>>> distributionUrl=
>>>>> 
>>>>> 
>>>> 
>>> 
>> https://nexus.company.com:8443/repository/maven-public//org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
>>>>> wrapperUrl=
>>>>> 
>>>>> 
>>>> 
>>> 
>> https://nexus.company.com:8443/repository/maven-public//org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
>>>>> 
>>>>> Even though the Maven Wrapper is downloaded from our Nexus, the
>>>>> dependencies are not, until I provide the settings.xml.
>>>>> 
>>>> 
>>> 
>> 
> 
> 
> -- 
> Sławomir Jaranowski


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


Re: Maven Wrapper: Using it with override settings.xml

Posted by Delany <de...@gmail.com>.
There's also a --global-setting parameter, so you could specify the
repository in one and the server details in the other. Their content is
merged with the user settings taking precedence.
Delany


On Tue, 13 Sept 2022 at 13:30, Sverre Moe <sv...@gmail.com> wrote:

> That means you have to check in the settings.xml into git.
> I am not comfortable doing this, considering the server config in
> settings.xml has the deployment password, although being obfuscated.
>
> /Sverre
>
> tir. 13. sep. 2022 kl. 12:00 skrev Slawomir Jaranowski <
> s.jaranowski@gmail.com>:
>
> > Hi,
> >
> > You can create file: .mvn/maven.config [1] with content
> >
> > --settings ./settings.xml
> >
> > [1] https://maven.apache.org/configure.html#mvn-maven-config-file
> >
> > wt., 13 wrz 2022 o 11:46 Delany <de...@gmail.com> napisał(a):
> >
> > > I used to place them in <project>/.mvn/settings.xml but khmarbaise
> > advised
> > > against, so I inject the settings.xml file in via a Jenkins plugin
> > > Delany
> > >
> > > On Tue, 13 Sept 2022 at 11:33, Sverre Moe <sv...@gmail.com>
> wrote:
> > >
> > > > But I still need to provide the settings.xml on all servers, and to
> all
> > > > users from somewhere.
> > > > Is there any way to repackage the maven distribution to include our
> > > > settings.xml like we do for the Gradle distribution?
> > > >
> > > > It would help if we could refer to an URL and not file. However then
> > all
> > > > who use the Maven Wrapper need to write a very long command line.
> > > > ./mvnw --settings
> > > > https://nexus.company.com:8443/repository/java/maven/settings.xml
> > clean
> > > > install
> > > >
> > > > tir. 13. sep. 2022 kl. 10:16 skrev Mantas Gridinas <
> > mgridinas@gmail.com
> > > >:
> > > >
> > > > > You can override which settings file is used with --settings flag.
> > > > >
> > > > > On Tue, Sep 13, 2022, 11:08 Sverre Moe <sv...@gmail.com>
> wrote:
> > > > >
> > > > > > I have been looking into the Maven Wrapper. We have mostly been
> > using
> > > > > > Gradle for new projects, but I was thinking of taking the Maven
> > > Wrapper
> > > > > in
> > > > > > use for our legacy projects that still use Maven.
> > > > > >
> > > > > > With Gradle we can create a custom gradle distribution that has
> all
> > > > > common
> > > > > > settings and properties needed by projects built by gradle.
> > > > > >
> > > > > > How can we do the same with Maven?
> > > > > >
> > > > > > Now we have the files settings.xml and settings-security.xml
> stored
> > > in
> > > > > > ~/.m2, which must be copied by all users into their own user home
> > > > > > directory.
> > > > > >
> > > > > > Running mvn wrapper:wrapper gave me this maven-wrapper.properties
> > > > > >
> > > > > > distributionUrl=
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> https://nexus.company.com:8443/repository/maven-public//org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
> > > > > > wrapperUrl=
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> https://nexus.company.com:8443/repository/maven-public//org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
> > > > > >
> > > > > > Even though the Maven Wrapper is downloaded from our Nexus, the
> > > > > > dependencies are not, until I provide the settings.xml.
> > > > > >
> > > > >
> > > >
> > >
> >
> >
> > --
> > Sławomir Jaranowski
> >
>

Re: Maven Wrapper: Using it with override settings.xml

Posted by Sverre Moe <sv...@gmail.com>.
That means you have to check in the settings.xml into git.
I am not comfortable doing this, considering the server config in
settings.xml has the deployment password, although being obfuscated.

/Sverre

tir. 13. sep. 2022 kl. 12:00 skrev Slawomir Jaranowski <
s.jaranowski@gmail.com>:

> Hi,
>
> You can create file: .mvn/maven.config [1] with content
>
> --settings ./settings.xml
>
> [1] https://maven.apache.org/configure.html#mvn-maven-config-file
>
> wt., 13 wrz 2022 o 11:46 Delany <de...@gmail.com> napisał(a):
>
> > I used to place them in <project>/.mvn/settings.xml but khmarbaise
> advised
> > against, so I inject the settings.xml file in via a Jenkins plugin
> > Delany
> >
> > On Tue, 13 Sept 2022 at 11:33, Sverre Moe <sv...@gmail.com> wrote:
> >
> > > But I still need to provide the settings.xml on all servers, and to all
> > > users from somewhere.
> > > Is there any way to repackage the maven distribution to include our
> > > settings.xml like we do for the Gradle distribution?
> > >
> > > It would help if we could refer to an URL and not file. However then
> all
> > > who use the Maven Wrapper need to write a very long command line.
> > > ./mvnw --settings
> > > https://nexus.company.com:8443/repository/java/maven/settings.xml
> clean
> > > install
> > >
> > > tir. 13. sep. 2022 kl. 10:16 skrev Mantas Gridinas <
> mgridinas@gmail.com
> > >:
> > >
> > > > You can override which settings file is used with --settings flag.
> > > >
> > > > On Tue, Sep 13, 2022, 11:08 Sverre Moe <sv...@gmail.com> wrote:
> > > >
> > > > > I have been looking into the Maven Wrapper. We have mostly been
> using
> > > > > Gradle for new projects, but I was thinking of taking the Maven
> > Wrapper
> > > > in
> > > > > use for our legacy projects that still use Maven.
> > > > >
> > > > > With Gradle we can create a custom gradle distribution that has all
> > > > common
> > > > > settings and properties needed by projects built by gradle.
> > > > >
> > > > > How can we do the same with Maven?
> > > > >
> > > > > Now we have the files settings.xml and settings-security.xml stored
> > in
> > > > > ~/.m2, which must be copied by all users into their own user home
> > > > > directory.
> > > > >
> > > > > Running mvn wrapper:wrapper gave me this maven-wrapper.properties
> > > > >
> > > > > distributionUrl=
> > > > >
> > > > >
> > > >
> > >
> >
> https://nexus.company.com:8443/repository/maven-public//org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
> > > > > wrapperUrl=
> > > > >
> > > > >
> > > >
> > >
> >
> https://nexus.company.com:8443/repository/maven-public//org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
> > > > >
> > > > > Even though the Maven Wrapper is downloaded from our Nexus, the
> > > > > dependencies are not, until I provide the settings.xml.
> > > > >
> > > >
> > >
> >
>
>
> --
> Sławomir Jaranowski
>

Re: Maven Wrapper: Using it with override settings.xml

Posted by Slawomir Jaranowski <s....@gmail.com>.
Hi,

You can create file: .mvn/maven.config [1] with content

--settings ./settings.xml

[1] https://maven.apache.org/configure.html#mvn-maven-config-file

wt., 13 wrz 2022 o 11:46 Delany <de...@gmail.com> napisał(a):

> I used to place them in <project>/.mvn/settings.xml but khmarbaise advised
> against, so I inject the settings.xml file in via a Jenkins plugin
> Delany
>
> On Tue, 13 Sept 2022 at 11:33, Sverre Moe <sv...@gmail.com> wrote:
>
> > But I still need to provide the settings.xml on all servers, and to all
> > users from somewhere.
> > Is there any way to repackage the maven distribution to include our
> > settings.xml like we do for the Gradle distribution?
> >
> > It would help if we could refer to an URL and not file. However then all
> > who use the Maven Wrapper need to write a very long command line.
> > ./mvnw --settings
> > https://nexus.company.com:8443/repository/java/maven/settings.xml clean
> > install
> >
> > tir. 13. sep. 2022 kl. 10:16 skrev Mantas Gridinas <mgridinas@gmail.com
> >:
> >
> > > You can override which settings file is used with --settings flag.
> > >
> > > On Tue, Sep 13, 2022, 11:08 Sverre Moe <sv...@gmail.com> wrote:
> > >
> > > > I have been looking into the Maven Wrapper. We have mostly been using
> > > > Gradle for new projects, but I was thinking of taking the Maven
> Wrapper
> > > in
> > > > use for our legacy projects that still use Maven.
> > > >
> > > > With Gradle we can create a custom gradle distribution that has all
> > > common
> > > > settings and properties needed by projects built by gradle.
> > > >
> > > > How can we do the same with Maven?
> > > >
> > > > Now we have the files settings.xml and settings-security.xml stored
> in
> > > > ~/.m2, which must be copied by all users into their own user home
> > > > directory.
> > > >
> > > > Running mvn wrapper:wrapper gave me this maven-wrapper.properties
> > > >
> > > > distributionUrl=
> > > >
> > > >
> > >
> >
> https://nexus.company.com:8443/repository/maven-public//org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
> > > > wrapperUrl=
> > > >
> > > >
> > >
> >
> https://nexus.company.com:8443/repository/maven-public//org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
> > > >
> > > > Even though the Maven Wrapper is downloaded from our Nexus, the
> > > > dependencies are not, until I provide the settings.xml.
> > > >
> > >
> >
>


-- 
Sławomir Jaranowski

Re: Maven Wrapper: Using it with override settings.xml

Posted by Delany <de...@gmail.com>.
I used to place them in <project>/.mvn/settings.xml but khmarbaise advised
against, so I inject the settings.xml file in via a Jenkins plugin
Delany

On Tue, 13 Sept 2022 at 11:33, Sverre Moe <sv...@gmail.com> wrote:

> But I still need to provide the settings.xml on all servers, and to all
> users from somewhere.
> Is there any way to repackage the maven distribution to include our
> settings.xml like we do for the Gradle distribution?
>
> It would help if we could refer to an URL and not file. However then all
> who use the Maven Wrapper need to write a very long command line.
> ./mvnw --settings
> https://nexus.company.com:8443/repository/java/maven/settings.xml clean
> install
>
> tir. 13. sep. 2022 kl. 10:16 skrev Mantas Gridinas <mg...@gmail.com>:
>
> > You can override which settings file is used with --settings flag.
> >
> > On Tue, Sep 13, 2022, 11:08 Sverre Moe <sv...@gmail.com> wrote:
> >
> > > I have been looking into the Maven Wrapper. We have mostly been using
> > > Gradle for new projects, but I was thinking of taking the Maven Wrapper
> > in
> > > use for our legacy projects that still use Maven.
> > >
> > > With Gradle we can create a custom gradle distribution that has all
> > common
> > > settings and properties needed by projects built by gradle.
> > >
> > > How can we do the same with Maven?
> > >
> > > Now we have the files settings.xml and settings-security.xml stored in
> > > ~/.m2, which must be copied by all users into their own user home
> > > directory.
> > >
> > > Running mvn wrapper:wrapper gave me this maven-wrapper.properties
> > >
> > > distributionUrl=
> > >
> > >
> >
> https://nexus.company.com:8443/repository/maven-public//org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
> > > wrapperUrl=
> > >
> > >
> >
> https://nexus.company.com:8443/repository/maven-public//org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
> > >
> > > Even though the Maven Wrapper is downloaded from our Nexus, the
> > > dependencies are not, until I provide the settings.xml.
> > >
> >
>

Re: Maven Wrapper: Using it with override settings.xml

Posted by Sverre Moe <sv...@gmail.com>.
But I still need to provide the settings.xml on all servers, and to all
users from somewhere.
Is there any way to repackage the maven distribution to include our
settings.xml like we do for the Gradle distribution?

It would help if we could refer to an URL and not file. However then all
who use the Maven Wrapper need to write a very long command line.
./mvnw --settings
https://nexus.company.com:8443/repository/java/maven/settings.xml clean
install

tir. 13. sep. 2022 kl. 10:16 skrev Mantas Gridinas <mg...@gmail.com>:

> You can override which settings file is used with --settings flag.
>
> On Tue, Sep 13, 2022, 11:08 Sverre Moe <sv...@gmail.com> wrote:
>
> > I have been looking into the Maven Wrapper. We have mostly been using
> > Gradle for new projects, but I was thinking of taking the Maven Wrapper
> in
> > use for our legacy projects that still use Maven.
> >
> > With Gradle we can create a custom gradle distribution that has all
> common
> > settings and properties needed by projects built by gradle.
> >
> > How can we do the same with Maven?
> >
> > Now we have the files settings.xml and settings-security.xml stored in
> > ~/.m2, which must be copied by all users into their own user home
> > directory.
> >
> > Running mvn wrapper:wrapper gave me this maven-wrapper.properties
> >
> > distributionUrl=
> >
> >
> https://nexus.company.com:8443/repository/maven-public//org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
> > wrapperUrl=
> >
> >
> https://nexus.company.com:8443/repository/maven-public//org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
> >
> > Even though the Maven Wrapper is downloaded from our Nexus, the
> > dependencies are not, until I provide the settings.xml.
> >
>

Re: Maven Wrapper: Using it with override settings.xml

Posted by Mantas Gridinas <mg...@gmail.com>.
You can override which settings file is used with --settings flag.

On Tue, Sep 13, 2022, 11:08 Sverre Moe <sv...@gmail.com> wrote:

> I have been looking into the Maven Wrapper. We have mostly been using
> Gradle for new projects, but I was thinking of taking the Maven Wrapper in
> use for our legacy projects that still use Maven.
>
> With Gradle we can create a custom gradle distribution that has all common
> settings and properties needed by projects built by gradle.
>
> How can we do the same with Maven?
>
> Now we have the files settings.xml and settings-security.xml stored in
> ~/.m2, which must be copied by all users into their own user home
> directory.
>
> Running mvn wrapper:wrapper gave me this maven-wrapper.properties
>
> distributionUrl=
>
> https://nexus.company.com:8443/repository/maven-public//org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
> wrapperUrl=
>
> https://nexus.company.com:8443/repository/maven-public//org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
>
> Even though the Maven Wrapper is downloaded from our Nexus, the
> dependencies are not, until I provide the settings.xml.
>