I quickly mocked up the forceVersion with the groovy-maven-plugin and
it works very well. Here is the g-m-p pom:
http://rifers.org/paste/jdillon/show/3939
One of the src/it poms:
http://rifers.org/paste/jdillon/show/3938
And the change to InstallMojo:
http://rifers.org/paste/jdillon/show/3940 (full src)
http://rifers.org/paste/jdillon/show/3941 (just the diff)
With this change for forceVersion, then none of the src/it/*/pom.xml
files need to know anything about the current plugins version, as
they just assume that artifacts with version "testing" are the latest.
Normal install:install works as expected, so that once all of the
integration tests pass, the normal version of the artifacts make it
into the repository. Also, since "testing" is not a SNAPSHOT, the
invoker runs a tad bit faster since it doesn't have to resolve
SNAPSHOTS for the plugin being tested.
And... one can simple `mvn -Dit install` after a clean checkout and
clean repo and the build will perform as expected.
* * *
I think this is pretty easy/simple and should always work. Unless
you know of a better/simpler way... I'd like to get this change into
the maven-install-plugin.
--jason
On Mar 14, 2007, at 5:29 PM, Jason van Zyl wrote:
On 3 Mar 07, at 11:06 PM 3 Mar 07, Jason Dillon wrote:
Any comments on adding a 'forceVersion' param to the maven-install-
plugin, which will for all artifacts (including attached) to be
installed with the given version?
Why not just use test repositories? You can hack this with a
settings but is now easy to do in 2.1 expressly for the purpose of
making testing easier. Do you need to force a version if using test
repositories was simple?
Jason.
I'm thinking this would be really helpful for testing maven
plugins, so that in the pre-integration-test phase, one could use
the m-install-p to force all artifacts to be installed with a
'testing' version, then in the 'integration-test' phase run the m-
invoker-p to execute a set of maven projects to test/validate the
plugin works as expected, and then once that passes, the normal m-
install-p execution will install the real versions of the
artifacts into the repository.
This would allow the src/it/**/pom.xml files to use
<version>testing</version> for all of the plugin artifacts, and
would prevent broken artifacts (which don't pass tests) from
making it into the local repo cache (and thus available to other
projects).
For example:
----8<----
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<forceVersion>testing</forceVersion>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<projectsDirectory>${pom.basedir}/src/
it</projectsDirectory>
<pomIncludes>
<pomInclude>**/pom.xml</
pomInclude> <!-- all of these poms use <version>testing</version> -->
</pomIncludes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
---->8----
I've been digging around trying to figure out how to test my
plugins... so far I have not found a single example that just
works out of the box... I've gotten the groovy-maven-plugin
( http://svn.codehaus.org/mojo/trunk/mojo/mojo-sandbox/groovy-
maven-plugin/ ) to work *almost* as I'd like... the only exception
is that right now I have to hard-code the version of the plugin
being tested in each src/it/**/pom.xml... which I would really
like to avoid.
I've seen a few other plugins use the maven-plugin-management-
plugin... but I've no idea what it does... same thing with maven-
plug-it-plugin... both look like they might do something along the
lines to allow src/it/**/pom.xml to not need hardcoded plugin
versions... but I really can't tell.
Anyways... I think simply adding a 'forceVersion' to the maven-
install-plugin should solve this... and not introduce more plugins
to support/maintain.
--jason
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]