You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Nord, James" <JN...@nds.com> on 2009/12/09 19:15:55 UTC

Super pom / enforcer issues?

Hi all,

I'm having a really strange error in Maven 2.2.1 and the enforcer plugin.

Basically it appears as though the super pom is missing version definitions for the following even though they should be present according to the web documentation (and performing a help:effective-pom shows them listed in the pluginManagement section):
*       maven-clean-plugin
*       maven-deploy-plugin
*       maven-install-plugin
*       maven-site-plugin

Anyone any ideas what's happening?

> mvn validate
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building example
[INFO]    task-segment: [validate]
[INFO] ------------------------------------------------------------------------
[INFO] [enforcer:enforce {execution: enforce-rules}]
[INFO] artifact org.apache.maven.plugins:maven-site-plugin: checking for updates from central
[WARNING] Rule 1: org.apache.maven.plugins.enforcer.RequirePluginVersions failed with message:
Some plugins are missing valid versions:(LATEST RELEASE SNAPSHOT are not allowed )
org.apache.maven.plugins:maven-clean-plugin.    The version currently in use is 2.3
org.apache.maven.plugins:maven-deploy-plugin.   The version currently in use is 2.4
org.apache.maven.plugins:maven-install-plugin.  The version currently in use is 2.3
org.apache.maven.plugins:maven-site-plugin.     The version currently in use is 2.0.1
Found plugins without fixed release version defined.  Build is not reproducible.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Wed Dec 09 18:09:15 GMT 2009
[INFO] Final Memory: 6M/254M
[INFO] ------------------------------------------------------------------------

>mvn --version
Apache Maven 2.2.1 (r801777; 2009-08-06 20:16:01+0100)
Java version: 1.6.0_16
Java home: C:\Java\jdk1.6.0_16\jre
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"


-- begin pom.xml -
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>example</groupId>
        <artifactId>myPom</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <packaging>pom</packaging>
        <name>example</name>

        <build>
                <plugins>
                        <plugin>
                                <artifactId>maven-enforcer-plugin</artifactId>
                                <version>1.0-beta-1</version>
                                <executions>
                                        <execution>
                                                <id>enforce-rules</id>
                                                <goals>
                                                        <goal>enforce</goal>
                                                </goals>
                                                <phase>validate</phase>
                                                <configuration>
                                                        <rules>
                                                                <requireMavenVersion>
                                                                        <version>2.2.1</version>
                                                                </requireMavenVersion>
                                                                <requirePluginVersions>
                                                                        <message>Found plugins without fixed release version defined.  Build is not reproducible.</message>
                                                                </requirePluginVersions>
                                                        </rules>
                                                </configuration>
                                        </execution>
                                </executions>
                        </plugin>
                </plugins>
        </build>
</project>
-- end pom.xml -



  ________________________________

**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************



  ________________________________
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes.
To protect the environment please do not print this e-mail unless necessary.

An NDS Group Limited company. www.nds.com

Re: Super pom / enforcer issues?

Posted by Wayne Fay <wa...@gmail.com>.
> My take on the Enforcer plugin is to make builds reproducible given
> the same environment at a latter date.  Changing Maven version (or
> JDK!) changes the environment and is out of scope IMHO.  This is
> especially the case if you explicitly limit the version of Maven and
> JDK (and OS!) used in the enforcer rules, and setting these does
> make sure your build is reproducible.

Sounds like you want Enforcer to work like:

if version of plugin not in this pom, or a parent etc
and
maven version locked down
and
jdk version is locked down
and
maven super pom specifies version of this plugin
then
do not fail

You can certainly hack the code yourself or file a JIRA to make it
work like you expect with a configurable flag to turn that feature
on/off.

Wayne

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


RE: Super pom / enforcer issues?

Posted by "Nord, James" <JN...@nds.com>.
Comments inline.

Regards,

        /James


>>2009/12/9 Nord, James <JN...@nds.com>:
>> I'm having a really strange error in Maven 2.2.1 and the enforcer plugin.
>>
>> Basically it appears as though the super pom is missing version definitions for the following even though they should be present according to the web documentation (and performing a help:effective-pom shows them listed in the pluginManagement section):
>> *       maven-clean-plugin
>> *       maven-deploy-plugin
>> *       maven-install-plugin
>> *       maven-site-plugin
>>
>> Anyone any ideas what's happening?

>If I read your mail correctly then you're thinking the Enforcer plugin
>should not complain about missing versions if those versions are
>provided by the super pom.

Correct.

>But think about it, if you upgrade to a
>newer Maven version then you could get a different super pom and as
>such your build is not reproducible.

But the build is reproducible - you made an invalid assumption.  In our builds we record the Maven version used to do the build so if we want to reproduce it we use exactly the same maven version on exactly the same platform with exactly the same JDK.
I don't expect any maven version to give exactly the same results as a different version.

>You should explicitly list the versions of everything you use. Don't
>depend on the super pom to do it for you. The Enforcer plugin is just
>doing what you asked it to do.

From the documentation:
"The Super POM is Maven's default POM. All POMs extend the Super POM unless explicitly set"

"This rule enforces that all plugins have a version defined, either in the plugin or pluginManagement section of the pom or a parent pom."

The combination of the two says to me that my POM implicitly has the Super POM as its parent, and hence *does* have the versions defined.

My take on the Enforcer plugin is to make builds reproducible given the same environment at a latter date.  Changing Maven version (or JDK!) changes the environment and is out of scope IMHO.  This is especially the case if you explicitly limit the version of Maven and JDK (and OS!) used in the enforcer rules, and setting these does make sure your build is reproducible.





**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************

This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes.
To protect the environment please do not print this e-mail unless necessary.

An NDS Group Limited company. www.nds.com

Re: Super pom / enforcer issues?

Posted by Hilco Wijbenga <hi...@gmail.com>.
2009/12/9 Nord, James <JN...@nds.com>:
> I'm having a really strange error in Maven 2.2.1 and the enforcer plugin.
>
> Basically it appears as though the super pom is missing version definitions for the following even though they should be present according to the web documentation (and performing a help:effective-pom shows them listed in the pluginManagement section):
> *       maven-clean-plugin
> *       maven-deploy-plugin
> *       maven-install-plugin
> *       maven-site-plugin
>
> Anyone any ideas what's happening?

If I read your mail correctly then you're thinking the Enforcer plugin
should not complain about missing versions if those versions are
provided by the super pom. But think about it, if you upgrade to a
newer Maven version then you could get a different super pom and as
such your build is not reproducible.

You should explicitly list the versions of everything you use. Don't
depend on the super pom to do it for you. The Enforcer plugin is just
doing what you asked it to do.

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