Problem Adding Classifier Support to NMaven

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem Adding Classifier Support to NMaven

Shane Isbell
Some background on the issue: For any given project Maven needs to resolve
both the pom and the binary artifacts. During artifact resolving, the Maven
framework first invokes AssemblyRepositoryLayout.pathOf(pomArtifact) and
then AssemblyRepositoryLayout.pathOf(binaryArtifact).

NMaven does not put meta-data like the version or classifier in the file
name, but rather within the artifact directory structure. In the case of
version, this is fairly easy to handle because both the pomArtifact and the
binaryArtifact contain the version information: the pathOf method can append
the version to the artifact path. In the case of classifier, the pomArtifact
does not contain the classifier information (artifact.getClassifier()
returns null): the pathOf method has no way to append the classifier to the
artifact path for the pom. Thus under the current Maven version, we are
unable to handle transitive dependencies for artifacts with classifiers (due
to not finding the pom artifact).

I am going to mark this as one area where I cannot resolve the issue by
directly using the Maven APIs. This will require a change in core. I'll
investigate further, but I suspect it will involve making sure that pom
artifacts have the classifier information available.

Shane
Reply | Threaded
Open this post in threaded view
|

Re: Problem Adding Classifier Support to NMaven

brettporter
Administrator
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Problem Adding Classifier Support to NMaven

Shane Isbell
Hi Brett,

Interesting point. I designed it to use different poms for different
classifiers: this may not be needed. I'll need to investigate further. As it
works now, a user does not use a pom profile for each framework version
(doing so would allow the use of a single pom), but rather either specifies
the framework version within the compile plugin configuration or specifies
it within the nmaven-settings file. This allows a non-profiled pom.xml build
file to run in multiple environments.

Just to clarify the specific issue:

Under Maven, the directory structure is:
|---group-id
|      |---artifact-id
|             |---version
|                    |---pom.xml file

Under NMaven, the directory structure is:

 |---group-id
|      |---artifact-id
|             |---version
|                    |---classifier
|                           |---pom.xml file

The artifact.getClassifier() always returns null for the pom artifact. This
is not a problem for finding a maven pom, since the pom file does not use
the classifier within its path: its just groupId, artifactid, version.
NMaven needs this classifier information to even locate the pom. Take a look
at the code below, where the pathOf method appends the
artifact.getClassifier() to the artifactPath of the pom.

    public String pathOf( Artifact artifact )
    {
        StringBuffer artifactPath = new StringBuffer();
        for ( String groupId : artifact.getGroupId().split( "[.]" ) )
        {
            artifactPath.append( groupId ).append( File.separator );
        }

        artifactPath.append( artifact.getArtifactId() ).append(
File.separator ).append( artifact.getBaseVersion() ).
            append( File.separator );
*        if ( artifact.hasClassifier() )
        {
            artifactPath.append( artifact.getClassifier() ).append(
File.separator );
        }*

        artifactPath.append( artifact.getArtifactId() ).append( "."
).append(
            ( artifact.getArtifactHandler() ).getExtension() );
        return artifactPath.toString();
    }

Shane

On 3/5/07, Brett Porter <[hidden email]> wrote:

>
> The pom never has a classifier - the same pom is used for all
> artifacts with a given id pair, so this is the correct behaviour.
>
> Is there another reason it's not working, or ill using the POM as is
> solve the problem?
>
> - Brett
>
> On 04/02/2007, at 9:21 PM, Shane Isbell wrote:
>
> > Some background on the issue: For any given project Maven needs to
> > resolve
> > both the pom and the binary artifacts. During artifact resolving,
> > the Maven
> > framework first invokes AssemblyRepositoryLayout.pathOf
> > (pomArtifact) and
> > then AssemblyRepositoryLayout.pathOf(binaryArtifact).
> >
> > NMaven does not put meta-data like the version or classifier in the
> > file
> > name, but rather within the artifact directory structure. In the
> > case of
> > version, this is fairly easy to handle because both the pomArtifact
> > and the
> > binaryArtifact contain the version information: the pathOf method
> > can append
> > the version to the artifact path. In the case of classifier, the
> > pomArtifact
> > does not contain the classifier information (artifact.getClassifier()
> > returns null): the pathOf method has no way to append the
> > classifier to the
> > artifact path for the pom. Thus under the current Maven version, we
> > are
> > unable to handle transitive dependencies for artifacts with
> > classifiers (due
> > to not finding the pom artifact).
> >
> > I am going to mark this as one area where I cannot resolve the
> > issue by
> > directly using the Maven APIs. This will require a change in core.
> > I'll
> > investigate further, but I suspect it will involve making sure that
> > pom
> > artifacts have the classifier information available.
> >
> > Shane
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Problem Adding Classifier Support to NMaven

brettporter
Administrator
CONTENTS DELETED
The author has deleted this message.