Hi,

Le 23/07/2014 20:29, Karl Heinz Marbaise a écrit :
my assumption is to use the maven-compat artifact in your project

Actually, I already had this artifact in my dependencies. ;)
Your answer gave me the idea to try without, but it was worst.



Le 23/07/2014 22:06, Martin Gainty a écrit :
MG>woops localRepositoryManager was never set! ...this should help out
@Override
public  void  initialize()  throws  InitializationException
{
     RepositorySystem  repositorySystem;
     try  {
         repositorySystem=  
this.plexusComponentManager.getPlexus().lookup(RepositorySystem.class);
     }  catch  (ComponentLookupException  e)  {
         throw  new  InitializationException("Failed to lookup 
RepositorySystem",  e);
     }

     LocalRepository  localRepo=  new  
LocalRepository(this.aetherConfiguration.getLocalRepository());
     this.localRepositoryManager=  
repositorySystem.newLocalRepositoryManager(localRepo);
}

I have tried to set the local repository manager by hand.
I sub-classed MojoRule and overrode the readMavenProject( File ) method to set my local repository...


@Override
public MavenProject readMavenProject( File basedir ) throws Exception {

        // New
DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
        RepositorySystem repositorySystem;
        try {
repositorySystem = getContainer().lookup( RepositorySystem.class );

        } catch (ComponentLookupException e) {
throw new InitializationException("Failed to lookup RepositorySystem", e);
        }

LocalRepository localRepo = new LocalRepository( new File( "/home/vzurczak/.m2/repository" )); LocalRepositoryManager localRepositoryManager = repositorySystem.newLocalRepositoryManager( repositorySession, localRepo );
        // New

        File pom = new File( basedir, "pom.xml" );
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
        request.setBaseDirectory( basedir );
ProjectBuildingRequest configuration = request.getProjectBuildingRequest();

        // Fix
repositorySession.setLocalRepositoryManager( localRepositoryManager );
        configuration.setRepositorySession( repositorySession );
        // Fix

MavenProject project = lookup( ProjectBuilder.class ).build( pom, configuration ).getProject();
        Assert.assertNotNull( project );
        return project;
}

However, when I run my tests, my plug-in is not found.


[ERROR] Unresolveable build extension: Plugin net.roboconf:roboconf-maven-plugin:1.0-SNAPSHOT or one of its dependencies could not be resolved: Failed to read artifact descriptor for net.roboconf:roboconf-maven-plugin:jar:1.0-SNAPSHOT @

So, setting the usual local repo ignores the plugin under test.
I don't know if I could add my target directory as some sort of special repo. On the other hand, maybe I am not using the testing-harness plugin correctly. :|

For the curious, the project is here. [0]
You can comment the things related to the roboconf-core module (in the POM and in the validate mojo).



Le 24/07/2014 04:35, Barrie Treloar a écrit :
Back when I was trying to use them you had a choice of 3, I think its not down to one but I dont know if the documentation on how to set it up and use it is readily available. When you get your answers, would you add to the knowledge base? It is always good to get fresh eyes on these things as the people who already know what's going on make assumptions that someone just starting out need to know about.

Sure. I could help to update the documentation... once it works. :)
Is forking https://github.com/apache/maven-plugin-testing and submitting a pull request the best way to propose a patch?

Best regards,

                        Vincent.



[ 0 ] : https://github.com/roboconf/roboconf-maven-plugin


--
Vincent Zurczak
Linagora: www.linagora.com <http://www.linagora.com/>

Twitter <https://twitter.com/VincentZurczak> Vincent Zurczak @ LinkedIn <http://fr.linkedin.com/pub/vincent-zurczak/18/b35/6a7> My Skype ID <callto://vincent.zurczak> My English blog <http://vzurczak.wordpress.com>

Reply via email to