You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Hilco Wijbenga <hi...@gmail.com> on 2008/01/11 02:06:23 UTC

Maven Enforcer Plugin

I ran into some issues with the Maven Enforcer plugin. Since I'm using
the latest and greatest straight from Subversion I didn't want to
create a JIRA ticket without first making sure that that would be
helpful.

Given that 1.0-alpha-3 doesn't support requirePluginVersions I want to
use 1.0-SNAPSHOT. However, I don't want to force other developers to
install the Enforcer locally (I haven't set up a mirror repository
yet) so I figured I'd use a profile. As it turns out, however, if I
put m-e-p in a profile like so

<profile>
  <id>enforce</id>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>1.0-Local-1</version>
          <executions>...</executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>1.0-Local-1</version>
      </plugin>
    </plugins>
  </build>
</profile>

and then run something like "mvn compile -Penforce", it fails because
the Compiler plugin has not been explicitely set. Perfect.

However, once its version has been specified (and those for the Site,
Install, Deploy, Compiler, Jar, Surefire, Resources, and Clean
plugins), the Enforcer *still* complains ... about its own version!
Even though I've specified it in two places. Removing the profile part
and putting the Enforcer straight into the <build>...</build> works,
though.

So this leads me to two questions:

1. Why do I have to specify seemingly unrelated plugins when only
requesting the Compiler plugin? (This is not a big deal, of course,
I'll have to set their versions anyway.)
2. Should the profile set up work?

Cheers,
Hilco

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


Re: Maven Enforcer Plugin

Posted by Hilco Wijbenga <hi...@gmail.com>.
On Jan 10, 2008 6:33 PM, Brian E. Fox <br...@reply.infinity.nu> wrote:
> Hilco, I'll have to take a deeper look, it's possible that I missed some
> other cases. I had to manually read and interpret the poms since I
> couldn't get them unmolested from the core. Can you open a jira and
> attach a sample so I can debug it?

http://jira.codehaus.org/browse/MENFORCER-29

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


RE: Maven Enforcer Plugin

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
Hilco, I'll have to take a deeper look, it's possible that I missed some
other cases. I had to manually read and interpret the poms since I
couldn't get them unmolested from the core. Can you open a jira and
attach a sample so I can debug it?


-----Original Message-----
From: Hilco Wijbenga [mailto:hilco.wijbenga@gmail.com] 
Sent: Thursday, January 10, 2008 9:29 PM
To: Maven Developers List
Subject: Re: Maven Enforcer Plugin

Hi Brian,

On Jan 10, 2008 5:40 PM, Brian E. Fox <br...@reply.infinity.nu> wrote:
> The enforcer plugin requirePluginVersions rule intentionally scans
> everything in your pom inheritance to see anything that isn't defined.
> This also includes things you haven't declared but are being used by
the
> standard lifecycle (compile,install etc etc). The alternative is that
> everytime you tried something new, it would complain about the
version.

That's fine with me, like I said, I have to specify those versions
anyway. It just surprised me a bit.

> It also doesn't care if the profile is active or not, if you declare a
> plugin without a version anywhere...the enforcer will punch you in the
> face.

Yes, but what I don't understand is why I'm being punched in the face
when I've specified the version twice ... but in the profile. :-) And
it's complaining about its *own* version. Which, again, I *have*
specified.

> There is one known issue right now and that's when you run mvn site.
It
> gets confused because mvn injects the reporting plugins into the
project
> as plugins and since I'm not currently scanning the reporing
> declarations, it incorrectly says they aren't locked down. Once I get
> time to fix this, I'll be putting out 1.0.

Mmmmh, I didn't run into this when running mvn site?

Cheers,
Hilco

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


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


Re: Maven Enforcer Plugin

Posted by Hilco Wijbenga <hi...@gmail.com>.
Hi Brian,

On Jan 10, 2008 5:40 PM, Brian E. Fox <br...@reply.infinity.nu> wrote:
> The enforcer plugin requirePluginVersions rule intentionally scans
> everything in your pom inheritance to see anything that isn't defined.
> This also includes things you haven't declared but are being used by the
> standard lifecycle (compile,install etc etc). The alternative is that
> everytime you tried something new, it would complain about the version.

That's fine with me, like I said, I have to specify those versions
anyway. It just surprised me a bit.

> It also doesn't care if the profile is active or not, if you declare a
> plugin without a version anywhere...the enforcer will punch you in the
> face.

Yes, but what I don't understand is why I'm being punched in the face
when I've specified the version twice ... but in the profile. :-) And
it's complaining about its *own* version. Which, again, I *have*
specified.

> There is one known issue right now and that's when you run mvn site. It
> gets confused because mvn injects the reporting plugins into the project
> as plugins and since I'm not currently scanning the reporing
> declarations, it incorrectly says they aren't locked down. Once I get
> time to fix this, I'll be putting out 1.0.

Mmmmh, I didn't run into this when running mvn site?

Cheers,
Hilco

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


RE: Maven Enforcer Plugin

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
Hi Hilco,
The enforcer plugin requirePluginVersions rule intentionally scans
everything in your pom inheritance to see anything that isn't defined.
This also includes things you haven't declared but are being used by the
standard lifecycle (compile,install etc etc). The alternative is that
everytime you tried something new, it would complain about the version.
It also doesn't care if the profile is active or not, if you declare a
plugin without a version anywhere...the enforcer will punch you in the
face.

There is one known issue right now and that's when you run mvn site. It
gets confused because mvn injects the reporting plugins into the project
as plugins and since I'm not currently scanning the reporing
declarations, it incorrectly says they aren't locked down. Once I get
time to fix this, I'll be putting out 1.0.

--Brian

-----Original Message-----
From: Hilco Wijbenga [mailto:hilco.wijbenga@gmail.com] 
Sent: Thursday, January 10, 2008 8:06 PM
To: Maven Developers List
Subject: Maven Enforcer Plugin

I ran into some issues with the Maven Enforcer plugin. Since I'm using
the latest and greatest straight from Subversion I didn't want to
create a JIRA ticket without first making sure that that would be
helpful.

Given that 1.0-alpha-3 doesn't support requirePluginVersions I want to
use 1.0-SNAPSHOT. However, I don't want to force other developers to
install the Enforcer locally (I haven't set up a mirror repository
yet) so I figured I'd use a profile. As it turns out, however, if I
put m-e-p in a profile like so

<profile>
  <id>enforce</id>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>1.0-Local-1</version>
          <executions>...</executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>1.0-Local-1</version>
      </plugin>
    </plugins>
  </build>
</profile>

and then run something like "mvn compile -Penforce", it fails because
the Compiler plugin has not been explicitely set. Perfect.

However, once its version has been specified (and those for the Site,
Install, Deploy, Compiler, Jar, Surefire, Resources, and Clean
plugins), the Enforcer *still* complains ... about its own version!
Even though I've specified it in two places. Removing the profile part
and putting the Enforcer straight into the <build>...</build> works,
though.

So this leads me to two questions:

1. Why do I have to specify seemingly unrelated plugins when only
requesting the Compiler plugin? (This is not a big deal, of course,
I'll have to set their versions anyway.)
2. Should the profile set up work?

Cheers,
Hilco

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


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