How does a test repository help? I still need to configure in my src/ it/*/pom.xml the version of the plugin I'm testing.

Maybe I don't understand what you mean by "test repositories".

I just want my src/it/*/pom.xml to *always* use the right version of the plugin (ie. that which was just compiled). I don't want to have to go updating poms each time I make a new release to use the new version.

And even more important... the "install" phase happens *before* the "integration-test" phase, so I still need a way to get the artifacts into the repository before my integration-tests fire.

If you can explain a better way to achieve the desired result I'm all ears... but so far this is the only solution I can think of which will work 100% of the time.

Specifically what I mean is to add an execution of the maven-install- plugin:install w/forceVersion=testing to the "integration-tests" profile in the pre-integration-test phase. So this can be used with `mvn -Dit` to build and run integration tests, kinda like this:

    http://svn.codehaus.org/mojo/trunk/mojo/groovy-maven-plugin/pom.xml

Though ^^^ does not have any install bits. This works, but will fail if you don't `mvn install` first to get something into the local repo... and requires all src/it/*/pom.xml files to have the version of the plugin. I suppose this could be avoided with parent poms etc... but these are supposed to be simple stand-along poms... and adding parents into the mix just complicates things way too much. Much better to simple get know "testing" versions of the artifacts into the local repo _before_ the integration-test phase.

--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]

Reply via email to