Done: http://jira.codehaus.org/browse/MENFORCER-156

On 03.07.2013 15:27, Stephen Connolly wrote:
File the bug request against enforcer and let that move it *if* necessary
as initial evidence points to enforcer's issue


On 3 July 2013 13:40, Wolf Geldmacher wrote:

Hi list.

I just got hit by a weird interaction between two plugins, namely the
maven-enforcer-plugin and the maven-assembly-plugin:

I recently updated the versions for the plugins used in my build and
suddenly the creation of an assembly broke with an NPE:

[ERROR] Failed to execute goal org.apache.maven.plugins:**
maven-assembly-plugin:2.4:**single (assemble) on project extjars:
Execution assemble of goal org.apache.maven.plugins:**
maven-assembly-plugin:2.4:**single failed. NullPointerException -> [Help
1]

Now the strange part is, that the m-a-p version had not been updated and
the assembly descriptor had not been changed.

Further investigation revealed the update of m-e-p to be the cause of the
error, as reverting to 1.2 (down from 1.3) magically made the build work
again.

I think this is a bug/regression that should be fixed, but: which of the
plugins should I file the Jira against? Is the m-e-p destroying data that
it should not touch or did the changed behaviour of m-e-p uncover a bug in
m-a-p?

If nothing else here's more proof of the necessity of nailing down all the
versions to get a reproducible build...

If you feel up to reproducing/analyzing the error here are the two (merged
and stripped down) files required:

pom.xml:

<project 
xmlns="http://maven.apache.**org/POM/4.0.0<http://maven.apache.org/POM/4.0.0>
"
          
xmlns:xsi="http://www.w3.org/**2001/XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>
"
          
xsi:schemaLocation="http://**maven.apache.org/POM/4.0.0<http://maven.apache.org/POM/4.0.0>
http://maven.apache.org/xsd/**maven-4.0.0.xsd<http://maven.apache.org/xsd/maven-4.0.0.xsd>
">
     <modelVersion>4.0.0</**modelVersion>

     <properties>
<plugins.maven-enforcer-**plugin.version>1.3</plugins.**
maven-enforcer-plugin.version>
     </properties>

     <groupId>ch.pecunifex.maven</**groupId>
     <artifactId>extjars</**artifactId>
     <version>2014.0.0-SNAPSHOT</**version>
     <packaging>pom</packaging>
     <name>3rd-party Jars Assembly</name>
     <description>
         Collect all 3rd-party dependencies and assemble them for
redistribution.
     </description>

     <prerequisites>
         <maven>3.0</maven>
     </prerequisites>

     <dependencies>
         <dependency>
             <groupId>asm</groupId>
             <artifactId>asm-commons</**artifactId>
             <version>3.1</version>
         </dependency>
         <dependency>
             <groupId>asm</groupId>
             <artifactId>asm</artifactId>
             <version>3.1</version>
         </dependency>
         <!-- ... -->
     </dependencies>

     <build>
         <defaultGoal>package</**defaultGoal>
         <plugins>
                 <plugin>
<groupId>org.apache.maven.**plugins</groupId>
<artifactId>maven-clean-**plugin</artifactId>
                     <version>2.4.1</version>
                 </plugin>
                 <plugin>
<groupId>org.apache.maven.**plugins</groupId>
<artifactId>maven-deploy-**plugin</artifactId>
                     <version>2.7</version>
                 </plugin>
                 <plugin>
<groupId>org.apache.maven.**plugins</groupId>
<artifactId>maven-install-**plugin</artifactId>
                     <version>2.3.1</version>
                 </plugin>
                 <plugin>
<groupId>org.apache.maven.**plugins</groupId>
<artifactId>maven-site-plugin<**/artifactId>
                     <version>3.0</version>
                 </plugin>
             <plugin>
<groupId>org.apache.maven.**plugins</groupId>
<artifactId>maven-assembly-**plugin</artifactId>
                 <version>2.4</version>
                 <executions>
                     <execution>
                         <id>assemble</id>
                         <phase>package</phase>
<goals><goal>single</goal></**goals>
                         <configuration>
<appendAssemblyId>false</**appendAssemblyId>
                             <descriptors>
                                 <descriptor>
                                     extjars.xml
                                 </descriptor>
                             </descriptors>
                         </configuration>
                     </execution>
                 </executions>
             </plugin>
             <plugin>
<groupId>org.apache.maven.**plugins</groupId>
<artifactId>maven-enforcer-**plugin</artifactId>
<version>${plugins.maven-**enforcer-plugin.version}</**version>
                 <executions>
                     <execution>
                         <id>enforce-plugin-versions</**id>
                         <goals>
                             <goal>enforce</goal>
                         </goals>
                         <configuration>
                             <rules>
                                 <requirePluginVersions>
                                      <message>Best Practice is to always
define plugin versions!</message>
                                 </requirePluginVersions>
                             </rules>
                         </configuration>
                     </execution>
                 </executions>
             </plugin>
         </plugins>
     </build>
</project>

extjars.xml:

<assembly xmlns="http://maven.apache.**org/plugins/maven-assembly-**
plugin/assembly/1.1.2<http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2>
"
             
xmlns:xsi="http://www.w3.org/**2001/XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>
"
xsi:schemaLocation="http://**maven.apache.org/plugins/**
maven-assembly-plugin/**assembly/1.1.2<http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2>
http://maven.apache.org/xsd/**assembly-1.1.2.xsd<http://maven.apache.org/xsd/assembly-1.1.2.xsd>
">
     <id>extjars</id>
     <formats>
         <format>zip</format>
     </formats>
     <includeBaseDirectory>false</**includeBaseDirectory>

     <dependencySets>
         <dependencySet>
             <outputDirectory>java/ext</**outputDirectory>
             <fileMode>0644</fileMode>
             <directoryMode>0755</**directoryMode>
<useTransitiveDependencies>**false</**useTransitiveDependencies>
<useProjectArtifact>false</**useProjectArtifact>

             <includes>
<include>asm:asm-commons:jar:**3.1</include>
                 <include>asm:asm:jar:3.1</**include>
             </includes>
         </dependencySet>
     </dependencySets>
</assembly>

When called via:
     mvn -Dplugins.maven-enforcer-**plugin.version=1.2
a zip file is generated as expected, when called via
     mvn -Dplugins.maven-enforcer-**plugin.version=1.3
(or without argument) you will get the NPE.

Cheers,
Wolf

------------------------------**------------------------------**---------
To unsubscribe, e-mail: 
users-unsubscribe@maven.**apache.org<[email protected]>
For additional commands, e-mail: [email protected]




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

Reply via email to