Hi Karl-Heinz,
All maven-dependencies used by a plugin are removed from the plugin
classpath. These classes will be picked up from its parent classloader:
the executing Maven instance.
For that reason I don't see the need to split it up into 2 separate
modules. I would upgrade the Maven dependencies only for the rules(!) to
3.0.
With proper CI jobs[1] we can confirm that specific rules still work with
Maven2.
regards,
Robert
[1] https://builds.apache.org/view/M-R/view/Maven/
Op Fri, 04 Apr 2014 09:24:17 +0200 schreef Karl Heinz Marbaise
<khmarba...@gmx.de>:
Hi Robert,
first thanks for your thoughs and hints...
> Hi Karl-Heinz,
Let's make a clear separation between the plugin, the enforcer-api and
the standard rules.
Only the first one can be restricted to a specific Maven version by
specifying the prerequisite for Maven.
Although the standard rules are included by default, there's no real
relationship.
Be aware that you can also write custom rules. If there is no change to
the enforcer-api, it's hard to explain why you must upgrade.
The upgrade for the whole i see it the same way is currently not an
option...
I think it should be the rule itself which should require a specific
Maven version. So it would be nice if we could somehow specify the
required Maven version.
After reconsidering your thoughts what do you think about the following:
Making a supplemental module enforcer-rules-maven3 under maven-enforcer:
enforcer
+-- enforcer-api
+-- enforcer-rules
+-- enforcer-rules-maven3
+-- maven-enforcer-plugin
So we can put enforcer rules which are Maven 3 specific.
Of course they have to check the Maven version themselfs (may be as you
suggested by an annotation ?)..but can have maven 3 dependencies to work.
Furthermore it gives us the opportunity to smoothly transfer all other
rules over the time to maven 3 area and sometimes we have all rules in
Maven 3...and finally changing the dependencies and requirements to
Maven 3....
But for the above scenario regarding one thing i'm not sure.
Suppose we have a Maven 3 build and using maven-enforcer-plugin where
enforcer-rules3 is added as dependency which itself has dependencies to
Maven 3 parts (things like maven-core:3.X) which one will be on the
classpath ? Cause maven-enforcer-plugin has maven-core:2.X as
dependencies?
So this could be solved by not adding enforcer-rules-maven3 as a default
dependency to maven-enforcer-plugin but this would result in leaving it
to the user of enforcer-rules3 so the user needs to todo something like
this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.enforcer</groupId>
<artifactId>enforcer-rules-maven3</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
</plugin>
Right now I'm thinking of an Annotation. Maybe you also want to require
a specific Java version...
These are just some ideas, I just think it's too early to require M3,
the other options are extra codebases. Not my favorite.
Extra codebase is not my favorite too but going with a branch might be
an option...to prevent a hassle for the users...clearly saying
maven-enforcer-plugin:2.X is for Maven 3 whereas
maven-enforcer-plugin:1.X is for Maven 2.X....
As far as i remember we had such thing with maven-site-plugin as well
(Maven 2 / 3).
Or i have to go for a custom rule which i have to deliver separately
...So i Can make requirements as i need for the rule...
I have thought about the mojo project extra-enforcer-rules but this is
currently also Maven 2.0 based .....
Robert
Op Tue, 01 Apr 2014 08:09:10 +0200 schreef Karl Heinz Marbaise
<khmarba...@gmx.de>:
Hi Robert,
first of all thanks for your answer....
> For Maven2 all arguments are immediately processed, you can't trace
back
the values of -pl or -amd.
I think you should go for the easy and solid solution by requiring
specific Maven versions.
For instance: In the rule, read the version value of
/META-INF/maven/org.apache.maven/maven-core/pom.properties
I think I've found a simpler (?) solution to check for the Maven
version by using the parts of the rule RequireMavenVersion....so apart
from that....
All information i needed about the "mvn -pl ..." is only available via
classes / interfaces for Maven 3 but at the moment maven-enforcer is
based on Maven 2.0.6 interfaces...which do not contain the methods i
need...like this:
List<String> selectedProjects =
session.getRequest().getSelectedProjects();
(The MavenSession interface only contains getRequest() starting with
Maven 3) which would get the information about "mvn -pl m1,m2 .."...
So may be i oversight things but currently i see only three solutions:
1. Update Maven Enforcer to Maven 3.X only
In my opinion it is to early to go that hard way in particular
to fully drop down Maven 2.X compatibility so early
(may be in the future)
2. Create separate branches:
* 2.X Branch which is Maven 3 only
* 1.X branch which keeps Maven 2.X compatibility...
and drop that later (currently we have 1.3.1 out
as release. So the next could be 1.4 or 1.3.2)
3. Extract the code I have and create a separate Maven Plugin
to fullfil the needs and make that plugin Maven 3. only...
may be for a limited time. But may there are up comming other
rules which are Maven 3 only...This solution would solve
only the single rule.
What do you think?
Kind regards
Karl-Heinz Marbaise
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org