Default Version of plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Default Version of plugin

Martin Funk
How are the default versions of of a plugin in determined?

My setup chooses:
org.apache.maven.plugins:maven-war-plugin:2.2:war
where I'd expect:
org.apache.maven.plugins:maven-war-plugin:3.3:war

I.e.: I downloaded the current maven and execute it in place:
› ~/Downloads/apache-maven-3.6.3/bin/mvn -v                        
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /Users/mafulafunk/Downloads/apache-maven-3.6.3
Java version: 11.0.7, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
Default locale: en_DE, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.5", arch: "x86_64", family: "Mac"


When running
› ~/Downloads/apache-maven-3.6.3/bin/mvn clean package
agains this super simplistic pom.xml:
<project>
        <modelVersion>4.0.0</modelVersion>
        <groupId>foo.bar</groupId>
        <artifactId>baz</artifactId>
        <version>1</version>
        <packaging>war</packaging>
</project>

An error ist thrown:

[...]
[INFO] Building war: /Users/mafulafunk/Code/gitlab/eigenfunk/eigen_microprofile/target/baz-1.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.847 s
[INFO] Finished at: 2020-07-12T15:13:41+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project baz: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
[...]

Which surprises me as I thought the current plugin version 3.3.0
https://maven.apache.org/plugins/maven-war-plugin/index.html

What am I missing?

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Default Version of plugin

Maarten Mulders-2
Hi Martin,

Your super simplistic POM does not specify a parent, and as such it
inherits from the default POM that ships with Maven 3.6.3.

Using mvn help:effective-pom -Dverbose=true you can see how the
effective model for your project builds up, and there you'll find that
version 2.2 is determined by Maven 3.6.3 indeed.

You can declare the desired version for the Maven WAR Plugin by adding
this snippet to your POM:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.3.0</version>
      </plugin>

Hope this helps.

Maarten

On 12/07/2020 15:21, Martin Funk wrote:

> How are the default versions of of a plugin in determined?
>
> My setup chooses:
> org.apache.maven.plugins:maven-war-plugin:2.2:war
> where I'd expect:
> org.apache.maven.plugins:maven-war-plugin:3.3:war
>
> I.e.: I downloaded the current maven and execute it in place:
> › ~/Downloads/apache-maven-3.6.3/bin/mvn -v                        
> Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
> Maven home: /Users/mafulafunk/Downloads/apache-maven-3.6.3
> Java version: 11.0.7, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
> Default locale: en_DE, platform encoding: UTF-8
> OS name: "mac os x", version: "10.15.5", arch: "x86_64", family: "Mac"
>
>
> When running
> › ~/Downloads/apache-maven-3.6.3/bin/mvn clean package
> agains this super simplistic pom.xml:
> <project>
>         <modelVersion>4.0.0</modelVersion>
>         <groupId>foo.bar</groupId>
>         <artifactId>baz</artifactId>
>         <version>1</version>
>         <packaging>war</packaging>
> </project>
>
> An error ist thrown:
>
> [...]
> [INFO] Building war: /Users/mafulafunk/Code/gitlab/eigenfunk/eigen_microprofile/target/baz-1.war
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time:  0.847 s
> [INFO] Finished at: 2020-07-12T15:13:41+02:00
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project baz: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
> [...]
>
> Which surprises me as I thought the current plugin version 3.3.0
> https://maven.apache.org/plugins/maven-war-plugin/index.html
>
> What am I missing?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Default Version of plugin

Tamás Cservenák
Technically, plugin version comes from packaging mappings, not the
super-pom, but yes, Maarten is right that in this case maven version
"tells" version of plugin to be used.

HTH
T

On Sun, Jul 12, 2020 at 8:40 PM Maarten Mulders <[hidden email]>
wrote:

> Hi Martin,
>
> Your super simplistic POM does not specify a parent, and as such it
> inherits from the default POM that ships with Maven 3.6.3.
>
> Using mvn help:effective-pom -Dverbose=true you can see how the
> effective model for your project builds up, and there you'll find that
> version 2.2 is determined by Maven 3.6.3 indeed.
>
> You can declare the desired version for the Maven WAR Plugin by adding
> this snippet to your POM:
>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-war-plugin</artifactId>
>         <version>3.3.0</version>
>       </plugin>
>
> Hope this helps.
>
> Maarten
>
> On 12/07/2020 15:21, Martin Funk wrote:
> > How are the default versions of of a plugin in determined?
> >
> > My setup chooses:
> > org.apache.maven.plugins:maven-war-plugin:2.2:war
> > where I'd expect:
> > org.apache.maven.plugins:maven-war-plugin:3.3:war
> >
> > I.e.: I downloaded the current maven and execute it in place:
> > › ~/Downloads/apache-maven-3.6.3/bin/mvn -v
> > Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
> > Maven home: /Users/mafulafunk/Downloads/apache-maven-3.6.3
> > Java version: 11.0.7, vendor: AdoptOpenJDK, runtime:
> /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
> > Default locale: en_DE, platform encoding: UTF-8
> > OS name: "mac os x", version: "10.15.5", arch: "x86_64", family: "Mac"
> >
> >
> > When running
> > › ~/Downloads/apache-maven-3.6.3/bin/mvn clean package
> > agains this super simplistic pom.xml:
> > <project>
> >         <modelVersion>4.0.0</modelVersion>
> >         <groupId>foo.bar</groupId>
> >         <artifactId>baz</artifactId>
> >         <version>1</version>
> >         <packaging>war</packaging>
> > </project>
> >
> > An error ist thrown:
> >
> > [...]
> > [INFO] Building war:
> /Users/mafulafunk/Code/gitlab/eigenfunk/eigen_microprofile/target/baz-1.war
> > [INFO]
> ------------------------------------------------------------------------
> > [INFO] BUILD FAILURE
> > [INFO]
> ------------------------------------------------------------------------
> > [INFO] Total time:  0.847 s
> > [INFO] Finished at: 2020-07-12T15:13:41+02:00
> > [INFO]
> ------------------------------------------------------------------------
> > [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project
> baz: Error assembling WAR: webxml attribute is required (or pre-existing
> WEB-INF/web.xml if executing in update mode) -> [Help 1]
> > [...]
> >
> > Which surprises me as I thought the current plugin version 3.3.0
> > https://maven.apache.org/plugins/maven-war-plugin/index.html
> >
> > What am I missing?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Default Version of plugin

Martin Funk
So if not told otherwise, in plugin management, maven ist defaulting back to?
https://github.com/apache/maven/blob/master/maven-core/src/main/resources/META-INF/plexus/default-bindings.xml

Wow, I'm deeply surprised.

So, what is the recommended way to work with that? Is there a way to change the default-binding locally or is it recommended to to configure each plugin in the pom.xml as described by Maarten?

Configuring it in the pom would lead to this strange trait in my mind, that to enjoy the "default" benefits of a "current" core plugin I have to explicitly configure it.

mf


On 2020/07/12 19:48:45, Tamás Cservenák <[hidden email]> wrote:

> Technically, plugin version comes from packaging mappings, not the
> super-pom, but yes, Maarten is right that in this case maven version
> "tells" version of plugin to be used.
>
> HTH
> T
>
> On Sun, Jul 12, 2020 at 8:40 PM Maarten Mulders <[hidden email]>
> wrote:
>
> > Hi Martin,
> >
> > Your super simplistic POM does not specify a parent, and as such it
> > inherits from the default POM that ships with Maven 3.6.3.
> >
> > Using mvn help:effective-pom -Dverbose=true you can see how the
> > effective model for your project builds up, and there you'll find that
> > version 2.2 is determined by Maven 3.6.3 indeed.
> >
> > You can declare the desired version for the Maven WAR Plugin by adding
> > this snippet to your POM:
> >
> >       <plugin>
> >         <groupId>org.apache.maven.plugins</groupId>
> >         <artifactId>maven-war-plugin</artifactId>
> >         <version>3.3.0</version>
> >       </plugin>
> >
> > Hope this helps.
> >
> > Maarten
> >
> > On 12/07/2020 15:21, Martin Funk wrote:
> > > How are the default versions of of a plugin in determined?
> > >
> > > My setup chooses:
> > > org.apache.maven.plugins:maven-war-plugin:2.2:war
> > > where I'd expect:
> > > org.apache.maven.plugins:maven-war-plugin:3.3:war
> > >
> > > I.e.: I downloaded the current maven and execute it in place:
> > > › ~/Downloads/apache-maven-3.6.3/bin/mvn -v
> > > Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
> > > Maven home: /Users/mafulafunk/Downloads/apache-maven-3.6.3
> > > Java version: 11.0.7, vendor: AdoptOpenJDK, runtime:
> > /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
> > > Default locale: en_DE, platform encoding: UTF-8
> > > OS name: "mac os x", version: "10.15.5", arch: "x86_64", family: "Mac"
> > >
> > >
> > > When running
> > > › ~/Downloads/apache-maven-3.6.3/bin/mvn clean package
> > > agains this super simplistic pom.xml:
> > > <project>
> > >         <modelVersion>4.0.0</modelVersion>
> > >         <groupId>foo.bar</groupId>
> > >         <artifactId>baz</artifactId>
> > >         <version>1</version>
> > >         <packaging>war</packaging>
> > > </project>
> > >
> > > An error ist thrown:
> > >
> > > [...]
> > > [INFO] Building war:
> > /Users/mafulafunk/Code/gitlab/eigenfunk/eigen_microprofile/target/baz-1.war
> > > [INFO]
> > ------------------------------------------------------------------------
> > > [INFO] BUILD FAILURE
> > > [INFO]
> > ------------------------------------------------------------------------
> > > [INFO] Total time:  0.847 s
> > > [INFO] Finished at: 2020-07-12T15:13:41+02:00
> > > [INFO]
> > ------------------------------------------------------------------------
> > > [ERROR] Failed to execute goal
> > org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project
> > baz: Error assembling WAR: webxml attribute is required (or pre-existing
> > WEB-INF/web.xml if executing in update mode) -> [Help 1]
> > > [...]
> > >
> > > Which surprises me as I thought the current plugin version 3.3.0
> > > https://maven.apache.org/plugins/maven-war-plugin/index.html
> > >
> > > What am I missing?
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Default Version of plugin

mthmulders
That is correct, Martin. If not told otherwise, Maven would resort to
the default bindings, as Tamás explained. I don't know why it defaults
to a relatively old version in this case, maybe someone else on the list
knows.

My approach would be to pin those versions in the pluginManagement
section of your POM. If you're working in a larger organisation, it may
be worth to put such stuff in a parent POM that each individual
application inherits.

Hope this helps,

Maarten

On July 13th, 2020 at 09:11, Martin Funk wrote:

> So if not told otherwise, in plugin management, maven ist defaulting back to?
> https://github.com/apache/maven/blob/master/maven-core/src/main/resources/META-INF/plexus/default-bindings.xml
>
> Wow, I'm deeply surprised.
>
> So, what is the recommended way to work with that? Is there a way to change the default-binding locally or is it recommended to to configure each plugin in the pom.xml as described by Maarten?
>
> Configuring it in the pom would lead to this strange trait in my mind, that to enjoy the "default" benefits of a "current" core plugin I have to explicitly configure it.
>
> mf
>
>
> On 2020/07/12 19:48:45, Tamás Cservenák <[hidden email]> wrote:
>> Technically, plugin version comes from packaging mappings, not the
>> super-pom, but yes, Maarten is right that in this case maven version
>> "tells" version of plugin to be used.
>>
>> HTH
>> T
>>
>> On Sun, Jul 12, 2020 at 8:40 PM Maarten Mulders <[hidden email]>
>> wrote:
>>
>>> Hi Martin,
>>>
>>> Your super simplistic POM does not specify a parent, and as such it
>>> inherits from the default POM that ships with Maven 3.6.3.
>>>
>>> Using mvn help:effective-pom -Dverbose=true you can see how the
>>> effective model for your project builds up, and there you'll find that
>>> version 2.2 is determined by Maven 3.6.3 indeed.
>>>
>>> You can declare the desired version for the Maven WAR Plugin by adding
>>> this snippet to your POM:
>>>
>>>       <plugin>
>>>         <groupId>org.apache.maven.plugins</groupId>
>>>         <artifactId>maven-war-plugin</artifactId>
>>>         <version>3.3.0</version>
>>>       </plugin>
>>>
>>> Hope this helps.
>>>
>>> Maarten
>>>
>>> On 12/07/2020 15:21, Martin Funk wrote:
>>>> How are the default versions of of a plugin in determined?
>>>>
>>>> My setup chooses:
>>>> org.apache.maven.plugins:maven-war-plugin:2.2:war
>>>> where I'd expect:
>>>> org.apache.maven.plugins:maven-war-plugin:3.3:war
>>>>
>>>> I.e.: I downloaded the current maven and execute it in place:
>>>> › ~/Downloads/apache-maven-3.6.3/bin/mvn -v
>>>> Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
>>>> Maven home: /Users/mafulafunk/Downloads/apache-maven-3.6.3
>>>> Java version: 11.0.7, vendor: AdoptOpenJDK, runtime:
>>> /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
>>>> Default locale: en_DE, platform encoding: UTF-8
>>>> OS name: "mac os x", version: "10.15.5", arch: "x86_64", family: "Mac"
>>>>
>>>>
>>>> When running
>>>> › ~/Downloads/apache-maven-3.6.3/bin/mvn clean package
>>>> agains this super simplistic pom.xml:
>>>> <project>
>>>>         <modelVersion>4.0.0</modelVersion>
>>>>         <groupId>foo.bar</groupId>
>>>>         <artifactId>baz</artifactId>
>>>>         <version>1</version>
>>>>         <packaging>war</packaging>
>>>> </project>
>>>>
>>>> An error ist thrown:
>>>>
>>>> [...]
>>>> [INFO] Building war:
>>> /Users/mafulafunk/Code/gitlab/eigenfunk/eigen_microprofile/target/baz-1.war
>>>> [INFO]
>>> ------------------------------------------------------------------------
>>>> [INFO] BUILD FAILURE
>>>> [INFO]
>>> ------------------------------------------------------------------------
>>>> [INFO] Total time:  0.847 s
>>>> [INFO] Finished at: 2020-07-12T15:13:41+02:00
>>>> [INFO]
>>> ------------------------------------------------------------------------
>>>> [ERROR] Failed to execute goal
>>> org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project
>>> baz: Error assembling WAR: webxml attribute is required (or pre-existing
>>> WEB-INF/web.xml if executing in update mode) -> [Help 1]
>>>> [...]
>>>>
>>>> Which surprises me as I thought the current plugin version 3.3.0
>>>> https://maven.apache.org/plugins/maven-war-plugin/index.html
>>>>
>>>> What am I missing?
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [hidden email]
>>>> For additional commands, e-mail: [hidden email]
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]