Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aether-users] Creating metadata for local installation

Dennis Reedy wrote:

I followed the approach you used in your example, so the DefaultServiceLocator approach is being used. I just don't know what to tell the locator to add. You've been hinting around certain things, I think we;re getting closer, I just need details.

If not already done, I strongly suggest to take a peek at the source code of the DefaultServiceLocator class (or any other class whose usage is unclear, much guess work can be eliminated by taking a glance under the hood of open source projects...).

DefaultServiceLocator locator = new DefaultServiceLocator();
...
locator.addService( MetadataGeneratorFactory.class, SnapshotMetadataGeneratorFactory.class );

Is this what I should do? What if I'm dealing with non-snapshots? What else would need to be done?

Assuming you followed my above suggestion, you either notice that the constructor of org.apache.maven.repository.internal.DefaultServiceLocator already registers the two factories or you went for the wrong class.

Non-snapshots get their G-A-level metadata via VersionsMetadataGeneratorFactory.

Use of the proper service locator should be all that is required in your case. If not, you would have to find out what's different between your code and the examples [0, 1] from the aether-demo module that install/deploy artifacts and their metadata.


Benjamin


[0] https://github.com/sonatype/sonatype-aether/blob/master/aether-demo/src/main/java/demo/InstallArtifacts.java [1] https://github.com/sonatype/sonatype-aether/blob/master/aether-demo/src/main/java/demo/DeployArtifacts.java


Back to the top