You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by doballve <di...@digital-artefacts.fi> on 2007/01/23 12:46:06 UTC

RepositoryMetadataManager, Plexus, extensions

Hello,

I have a use case where I want to use public repositories, like central, and
internal repositories. All in the same maven project.. nothing new this far.
Some of the artifacts I store in the internal repository, like customer
specific material, are for sure never going to be found in central. My
problem is how to stop maven from trying to connect to central to get those
artifacts/metadata for which I know it should only look in internal. I could
not find out how to do it from the configuration level only.

So, I have created a very simple extension component that extends
maven-artifact's DefaultRepositoryMetadataManager resolver methods and will
filter the repositories list and only allow a repositories with id 
"xxx-..." for articafts with groupId "com.yyy....", then delegate actual
work to original class. I installed it as a jar with
META-INF/plexus/components.xml like this:

<component-set>
    <components>
        <component>
           
<role>org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager</role>
           
<implementation>com.yyy.MyRepositoryMetadataManager</implementation>
            <requirements>
                <requirement>
                   
<role>org.apache.maven.artifact.manager.WagonManager</role>
                </requirement>
            </requirements>
        </component>
    </components>
</component-set>

Then I tried to use the pom/build/extensions/extension element to get it
working but it failed miserably. My extension was detected, loaded, but
never used. Probably because DefaultRepositoryMetadataManager was up and
running already.

The only way I got it to work was by modifying MAVEN_HOME/bin/m2.conf to
make sure my xtension is loaded before other jars, like this:

[plexus.core.maven]
load ${maven.home}/lib/myextension.jar
load ${maven.home}/lib/*.jar

That require extra configuration in the development environment that I was
trying to avoid. If that would be the case i could use firewall to block
those requests and keep maven pristine... I wanted it to be bundled with the
project. Is there a way to achieve that? Can I force maven/plexus to reload
a component when it is redefined? Is there an alternative approach for
telling maven 'where' to look for 'what'? If not, doesn't it make sense as a
new feature?

Thanks,
Diego

-- 
View this message in context: http://www.nabble.com/RepositoryMetadataManager%2C-Plexus%2C-extensions-tf3063625s177.html#a8520099
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org