I've debugged a little and found out that
"org.eclipse.aether.internal.impl.SimpleLocalRepositoryManager.getPathForArtifact(
Artifact artifact, boolean local )" builds a path to the destination file in
the local maven repo like this (i've commented my values here):

        StringBuilder path = new StringBuilder( 128 );

        path.append( artifact.getGroupId().replace( '.', '/' ) ).append( '/'
); //GroupId=org\apache\karaf\examples

        path.append( artifact.getArtifactId() ).append( '/' );
//ArtifactId=karaf-bundle-example-client

        path.append( artifact.getBaseVersion() ).append( '/' );
//BaseVersion=4.3.0-SNAPSHOT

        path.append( artifact.getArtifactId() ).append( '-' );
//ArtifactId=karaf-bundle-example-client
        if ( local )
        {
            path.append( artifact.getBaseVersion() );
//BaseVersion=4.3.0-SNAPSHOT
        }
        else
        {
            path.append( artifact.getVersion() );
        }

        if ( artifact.getClassifier().length() > 0 )
        {
            path.append( '-' ).append( artifact.getClassifier() );
//Classifier=SNAPSHOT
        }

        if ( artifact.getExtension().length() > 0 )
        {
            path.append( '.' ).append( artifact.getExtension() );
//Extension=jar
        }

and the path results to:
"org\apache\karaf\examples/karaf-bundle-example-client/4.3.0-SNAPSHOT/karaf-bundle-example-client-4.3.0-SNAPSHOT-SNAPSHOT.jar".

In the local maven repo after kar explosion i see the files:

       _remote.repositories
       karaf-bundle-example-client-4.3.0-SNAPSHOT-local.xml
!!!    karaf-bundle-example-client-4.3.0-SNAPSHOT-SNAPSHOT.jar
       maven-metadata-local.xml
       maven-metadata-sdeployer.xml
       maven-metadata-sdeployer.xml.sha1
       resolver-status.properties

So i guess the problem is with "artifact.getBaseVersion()" implementation
which works correctly only if there is a timestamp in the artifact's
snapshot version.
Or if the artifact name in the local maven repo should contain timestamp,
the implementation of the
"org.apache.maven.repository.internal.LocalSnapshotMetadataGenerator.transformArtifact(
Artifact artifact )" method should be changed similar to the one in
"org.apache.maven.repository.internal.RemoteSnapshotMetadataGenerator" i
guess.

And one more thing. As you might notice, in
"org.apache.karaf.cave.deployer.service.DeployerServiceImpl.browseKar(...)"
method we resolve groupId by substring-ing the path to .jar file and
replacing slashes with dots:
       path = path.replace('/', '.');
but windows paths contain backslashes and groupIds on my machine look like
this:
       org\apache\karaf\examples



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Reply via email to