Robert Scholte closed Bug MMOCKRM-4 as Not A Bug

Let's close this as 'not a bug', because by chaining the invokers it works fine, although I'm still surprised by the original exception.

Chaining invokers

If your plugins uses the Maven Invoker and you want to use the maven-invoker-plugin for ITs, you need to chain them.

In your code, add the following

MyMojo.java
/**
     * The local repository where the artifacts are located.
     */
    @Parameter( defaultValue = "${localRepository}", readonly = true, required = true )
    private ArtifactRepository localRepository;

    /**
     * 
     */
    @Parameter ( property="settingsFile" )
    private File settingsFile;

// 
   protected void invokeMaven()
   {
        InvocationRequest request = new DefaultInvocationRequest();
        request.setUserSettingsFile( settingsFile );
        invoker.setLocalRepositoryDirectory( new File( localRepository.getBasedir() ) );
// etc ...
   }

Next you have to refer the settingsFile to the interpolated settings.xml, containing the configuration of the mock repository.

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-invoker-plugin</artifactId>
            <version>1.6</version>
...
            <configuration>
              <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
              <properties>
                <settingsFile>${project.build.directory}/it/interpolated-settings.xml</settingsFile>
              </properties>
...
            </configuration>
</plugin>

Although this is quite rare, it is probably worth a page on the site.

Change By: Robert Scholte (08/Sep/12 11:52 AM)
Resolution: Not A Bug
Assignee: Stephen Connolly Robert Scholte
Status: Open Closed
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to