You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Fabrizio Giustina <fg...@gmail.com> on 2005/08/20 14:52:49 UTC

[m2] handling source artifacts

Hi devs
while playing with the m2 eclipse plugin trying to add support for
source attachments I was stuck with some inconsistencies in artifact
naming.

Actually the m2 source plugin (JarSourceMojo) generates the name for
the jar file using finalName + "-sources.jar". This means that, given
a jar artifact such as junit-3.8.1.jar (full path in repo
M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar) it generates a jar named
junit-3.8.1-sources.jar.

This not only makes "sources" look like a part of the version token,
but, if I am not missing something, it makes impossible to reference
such artifact using maven APIs.
None of these can work:
artifactFactory.createArtifact( "junit", "junit", "3.8.1", null,
"-sources.jar" );
-> resolved to M2_REPO/junit/junit/3.8.1/junit-3.8.1.-sources.jar

artifactFactory.createArtifact( "junit", "junit", "3.8.1-sources",
null, ".jar" );
-> resolved to M2_REPO/junit/junit/3.8.1-sources/junit-3.8.1-sources.jar

What about start managing source archives as proper artifacts and
assign them a type? We could use "src.jar" as the standard artifact
type so that artifactFactory.createArtifact( "junit", "junit",
"3.8.1", null, "src.jar" ) can be used?

If this is ok I could try to provide a patch for the source and
eclipse plugins which will add a basic support for
uploading/downloading source zip...

fabrizio

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


Re: [m2] handling source artifacts

Posted by Fabrizio Giustina <fg...@gmail.com>.
Thanks Brett
I finally figured out by myself out how classifier works... I still
find a little confusing a naming like "artifact-1.2.3-sources.jar"
which looks so similar to "artifact-1.2.3-SNAPSHOT.jar", but with the
new repo layout things are pretty clear anyway...
I will shortly submit a patch for the eclipse plugin to download and
use sources jars, hope that somebody can have a look at it

thanks
fabrizio


On 8/21/05, Brett Porter <br...@apache.org> wrote:
> Fabrizio Giustina wrote:
> 
> >What about start managing source archives as proper artifacts and
> >assign them a type? We could use "src.jar" as the standard artifact
> >type so that artifactFactory.createArtifact( "junit", "junit",
> >"3.8.1", null, "src.jar" ) can be used?
> >
> >If this is ok I could try to provide a patch for the source and
> >eclipse plugins which will add a basic support for
> >uploading/downloading source zip...
> >
> >
> It's called a "classifier". You have two options:
> - create a type mapping so that src.jar becomes classifier = sources,
> extension = jar (I'd select a type of "sources" instead, and I'm more
> than happy to have this added)
> - use createArtifactWithClassifier and pass "sources" as the classifier
> and "jar" as the type.
> 
> These both should work right now.
> 
> - Brett
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 
>

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


Re: [m2] handling source artifacts

Posted by Brett Porter <br...@apache.org>.
Fabrizio Giustina wrote:

>What about start managing source archives as proper artifacts and
>assign them a type? We could use "src.jar" as the standard artifact
>type so that artifactFactory.createArtifact( "junit", "junit",
>"3.8.1", null, "src.jar" ) can be used?
>
>If this is ok I could try to provide a patch for the source and
>eclipse plugins which will add a basic support for
>uploading/downloading source zip...
>  
>
It's called a "classifier". You have two options:
- create a type mapping so that src.jar becomes classifier = sources,
extension = jar (I'd select a type of "sources" instead, and I'm more
than happy to have this added)
- use createArtifactWithClassifier and pass "sources" as the classifier
and "jar" as the type.

These both should work right now.

- Brett


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