You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Karl Heinz Marbaise <kh...@gmx.de> on 2015/08/09 15:21:52 UTC
https://issues.apache.org/jira/browse/MSHADE-195
Hi,
After diving into the above issue i stumbled over several things...
If you take a look here and the log output excerpt:
INFO] Minimized 2341 -> 1293
[INFO] Minimized 3282 -> 2234
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing
/Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT.jar
with
/Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-shaded.jar
[INFO] Replacing original source artifact with shaded source artifact.
[INFO] Replacing
/Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-sources.jar
with
/Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-shaded-sources.jar
[INFO] Dependency-reduced POM written at:
/Users/kama/ws-git/apache/mshade/mshade-195/dependency-reduced-pom.xml
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @
MSHADE-195-example ---
[INFO] Installing
/Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT.jar
to
/Users/kama/.m2/repository/com/example/MSHADE-195-example/1-SNAPSHOT/MSHADE-195-example-1-SNAPSHOT.jar
[INFO] Installing
/Users/kama/ws-git/apache/mshade/mshade-195/dependency-reduced-pom.xml
to
/Users/kama/.m2/repository/com/example/MSHADE-195-example/1-SNAPSHOT/MSHADE-195-example-1-SNAPSHOT.pom
[INFO] Installing
/Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-sources.jar
to
/Users/kama/.m2/repository/com/example/MSHADE-195-example/1-SNAPSHOT/MSHADE-195-example-1-SNAPSHOT-sources.jar
[INFO] Installing
/Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-sources.jar
to
/Users/kama/.m2/repository/com/example/MSHADE-195-example/1-SNAPSHOT/MSHADE-195-example-1-SNAPSHOT-sources.jar
[INFO]
Install plugin tries to install two identical artifacts which will work
for maven-install-plugin but would fail for a deploy to a repository
manager (releases? etc.
So after diving into the problem i found the following code in
maven-core (MavenProject.java):
/**
* Add or replace an artifact. This method is now deprecated. Use
the @{MavenProjectHelper} to attach artifacts to a
* project. In spite of the 'throws' declaration on this API, this
method has never thrown an exception since Maven
* 3.0.x. Historically, it logged and ignored a second addition of
the same g/a/v/c/t. Now it replaces the file for
* the artifact, so that plugins (e.g. shade) can change the
pathname of the file for a particular set of
* coordinates.
*
* @param artifact the artifact to add or replace.
* @throws DuplicateArtifactAttachmentException
*/
public void addAttachedArtifact( Artifact artifact )
throws DuplicateArtifactAttachmentException
{
getAttachedArtifacts().add( artifact );
}
public List<Artifact> getAttachedArtifacts()
{
if ( attachedArtifacts == null )
{
attachedArtifacts = new ArrayList<>();
}
return attachedArtifacts;
}
So taking a look into MavenProjectHelper.java and the implementation
(DefaultMavenProjectHelper.java).
/**
* Add an attached artifact or replace the file for an existing
artifact.
*
* @see
MavenProject#addAttachedArtifact(org.apache.maven.artifact.Artifact)
* @param project project reference.
* @param artifact artifact to add or replace.
*/
public void attachArtifact( MavenProject project, Artifact artifact )
{
project.addAttachedArtifact( artifact );
}
which means that there is not check if an artifacts is already attached.
This means two things from my point of view:
Change the maven-core (checking for duplicate attaches) and furthermore
plugins which are adding this should check themself if the artifact
already exist?
WDYT ? Better idea/suggestions ?
Kind regards
Karl Heinz Marbaise
https://issues.apache.org/jira/browse/MNG-5868
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: https://issues.apache.org/jira/browse/MSHADE-195
Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi,
On 8/20/15 4:06 PM, Jason van Zyl wrote:
> Right now attached artifacts are added to a list.
Which will result in failures during deploy phase in particular related
to repository managers...
Apart from that i think that adding the same artifact duplicates
(coordinates) looks wrong...
> If we only want to allow one attached artifact
> for a coordinate then we can change that to a map and let the
lifecycle update/replace
> the attachments.
> This way there cannot be duplicates
> which is likely what we want versus what’s there now.
I would say it would be wise to check and if someone tries to add
duplicated artifacts it should at least produce a WARNING....because
likely there is something wrong in the build...
> This internal change would potentially reduce the number
> of attached artifacts but at first blush I can’t see
> this doing any harm.
Neither do i....
Kind regards
Karl Heinz Marbaise
>
>> On Aug 20, 2015, at 3:51 AM, Karl Heinz Marbaise <kh...@gmx.de> wrote:
>>
>> Hi,
>>
>> someone ?
>>
>> On 8/9/15 3:21 PM, Karl Heinz Marbaise wrote:
>>> Hi,
>>>
>>> After diving into the above issue i stumbled over several things...
>>>
>>> If you take a look here and the log output excerpt:
>>>
>>> INFO] Minimized 2341 -> 1293
>>> [INFO] Minimized 3282 -> 2234
>>> [INFO] Replacing original artifact with shaded artifact.
>>> [INFO] Replacing
>>> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT.jar
>>> with
>>> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-shaded.jar
>>>
>>> [INFO] Replacing original source artifact with shaded source artifact.
>>> [INFO] Replacing
>>> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-sources.jar
>>> with
>>> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-shaded-sources.jar
>>>
>>> [INFO] Dependency-reduced POM written at:
>>> /Users/kama/ws-git/apache/mshade/mshade-195/dependency-reduced-pom.xml
>>> [INFO]
>>> [INFO] --- maven-install-plugin:2.5.2:install (default-install) @
>>> MSHADE-195-example ---
>>> [INFO] Installing
>>> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT.jar
>>> to
>>> /Users/kama/.m2/repository/com/example/MSHADE-195-example/1-SNAPSHOT/MSHADE-195-example-1-SNAPSHOT.jar
>>>
>>> [INFO] Installing
>>> /Users/kama/ws-git/apache/mshade/mshade-195/dependency-reduced-pom.xml
>>> to
>>> /Users/kama/.m2/repository/com/example/MSHADE-195-example/1-SNAPSHOT/MSHADE-195-example-1-SNAPSHOT.pom
>>>
>>> [INFO] Installing
>>> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-sources.jar
>>> to
>>> /Users/kama/.m2/repository/com/example/MSHADE-195-example/1-SNAPSHOT/MSHADE-195-example-1-SNAPSHOT-sources.jar
>>>
>>> [INFO] Installing
>>> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-sources.jar
>>> to
>>> /Users/kama/.m2/repository/com/example/MSHADE-195-example/1-SNAPSHOT/MSHADE-195-example-1-SNAPSHOT-sources.jar
>>>
>>> [INFO]
>>>
>>> Install plugin tries to install two identical artifacts which will work
>>> for maven-install-plugin but would fail for a deploy to a repository
>>> manager (releases? etc.
>>>
>>> So after diving into the problem i found the following code in
>>> maven-core (MavenProject.java):
>>>
>>> /**
>>> * Add or replace an artifact. This method is now deprecated. Use
>>> the @{MavenProjectHelper} to attach artifacts to a
>>> * project. In spite of the 'throws' declaration on this API, this
>>> method has never thrown an exception since Maven
>>> * 3.0.x. Historically, it logged and ignored a second addition of
>>> the same g/a/v/c/t. Now it replaces the file for
>>> * the artifact, so that plugins (e.g. shade) can change the
>>> pathname of the file for a particular set of
>>> * coordinates.
>>> *
>>> * @param artifact the artifact to add or replace.
>>> * @throws DuplicateArtifactAttachmentException
>>> */
>>> public void addAttachedArtifact( Artifact artifact )
>>> throws DuplicateArtifactAttachmentException
>>> {
>>> getAttachedArtifacts().add( artifact );
>>> }
>>>
>>> public List<Artifact> getAttachedArtifacts()
>>> {
>>> if ( attachedArtifacts == null )
>>> {
>>> attachedArtifacts = new ArrayList<>();
>>> }
>>> return attachedArtifacts;
>>> }
>>>
>>> So taking a look into MavenProjectHelper.java and the implementation
>>> (DefaultMavenProjectHelper.java).
>>>
>>> /**
>>> * Add an attached artifact or replace the file for an existing
>>> artifact.
>>> *
>>> * @see
>>> MavenProject#addAttachedArtifact(org.apache.maven.artifact.Artifact)
>>> * @param project project reference.
>>> * @param artifact artifact to add or replace.
>>> */
>>> public void attachArtifact( MavenProject project, Artifact artifact )
>>> {
>>> project.addAttachedArtifact( artifact );
>>> }
>>>
>>>
>>> which means that there is not check if an artifacts is already attached.
>>>
>>> This means two things from my point of view:
>>>
>>> Change the maven-core (checking for duplicate attaches) and furthermore
>>> plugins which are adding this should check themself if the artifact
>>> already exist?
>>>
>>> WDYT ? Better idea/suggestions ?
>>>
>>>
>>> Kind regards
>>> Karl Heinz Marbaise
>>>
>>> https://issues.apache.org/jira/browse/MNG-5868
>>>
>>> ---------------------------------------------------------------------
>>> 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: https://issues.apache.org/jira/browse/MSHADE-195
Posted by Jason van Zyl <ja...@takari.io>.
Right now attached artifacts are added to a list. If we only want to allow one attached artifact for a coordinate then we can change that to a map and let the lifecycle update/replace the attachments. This way there cannot be duplicates which is likely what we want versus what’s there now. This internal change would potentially reduce the number of attached artifacts but at first blush I can’t see this doing any harm.
> On Aug 20, 2015, at 3:51 AM, Karl Heinz Marbaise <kh...@gmx.de> wrote:
>
> Hi,
>
> someone ?
>
> On 8/9/15 3:21 PM, Karl Heinz Marbaise wrote:
>> Hi,
>>
>> After diving into the above issue i stumbled over several things...
>>
>> If you take a look here and the log output excerpt:
>>
>> INFO] Minimized 2341 -> 1293
>> [INFO] Minimized 3282 -> 2234
>> [INFO] Replacing original artifact with shaded artifact.
>> [INFO] Replacing
>> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT.jar
>> with
>> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-shaded.jar
>>
>> [INFO] Replacing original source artifact with shaded source artifact.
>> [INFO] Replacing
>> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-sources.jar
>> with
>> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-shaded-sources.jar
>>
>> [INFO] Dependency-reduced POM written at:
>> /Users/kama/ws-git/apache/mshade/mshade-195/dependency-reduced-pom.xml
>> [INFO]
>> [INFO] --- maven-install-plugin:2.5.2:install (default-install) @
>> MSHADE-195-example ---
>> [INFO] Installing
>> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT.jar
>> to
>> /Users/kama/.m2/repository/com/example/MSHADE-195-example/1-SNAPSHOT/MSHADE-195-example-1-SNAPSHOT.jar
>>
>> [INFO] Installing
>> /Users/kama/ws-git/apache/mshade/mshade-195/dependency-reduced-pom.xml
>> to
>> /Users/kama/.m2/repository/com/example/MSHADE-195-example/1-SNAPSHOT/MSHADE-195-example-1-SNAPSHOT.pom
>>
>> [INFO] Installing
>> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-sources.jar
>> to
>> /Users/kama/.m2/repository/com/example/MSHADE-195-example/1-SNAPSHOT/MSHADE-195-example-1-SNAPSHOT-sources.jar
>>
>> [INFO] Installing
>> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-sources.jar
>> to
>> /Users/kama/.m2/repository/com/example/MSHADE-195-example/1-SNAPSHOT/MSHADE-195-example-1-SNAPSHOT-sources.jar
>>
>> [INFO]
>>
>> Install plugin tries to install two identical artifacts which will work
>> for maven-install-plugin but would fail for a deploy to a repository
>> manager (releases? etc.
>>
>> So after diving into the problem i found the following code in
>> maven-core (MavenProject.java):
>>
>> /**
>> * Add or replace an artifact. This method is now deprecated. Use
>> the @{MavenProjectHelper} to attach artifacts to a
>> * project. In spite of the 'throws' declaration on this API, this
>> method has never thrown an exception since Maven
>> * 3.0.x. Historically, it logged and ignored a second addition of
>> the same g/a/v/c/t. Now it replaces the file for
>> * the artifact, so that plugins (e.g. shade) can change the
>> pathname of the file for a particular set of
>> * coordinates.
>> *
>> * @param artifact the artifact to add or replace.
>> * @throws DuplicateArtifactAttachmentException
>> */
>> public void addAttachedArtifact( Artifact artifact )
>> throws DuplicateArtifactAttachmentException
>> {
>> getAttachedArtifacts().add( artifact );
>> }
>>
>> public List<Artifact> getAttachedArtifacts()
>> {
>> if ( attachedArtifacts == null )
>> {
>> attachedArtifacts = new ArrayList<>();
>> }
>> return attachedArtifacts;
>> }
>>
>> So taking a look into MavenProjectHelper.java and the implementation
>> (DefaultMavenProjectHelper.java).
>>
>> /**
>> * Add an attached artifact or replace the file for an existing
>> artifact.
>> *
>> * @see
>> MavenProject#addAttachedArtifact(org.apache.maven.artifact.Artifact)
>> * @param project project reference.
>> * @param artifact artifact to add or replace.
>> */
>> public void attachArtifact( MavenProject project, Artifact artifact )
>> {
>> project.addAttachedArtifact( artifact );
>> }
>>
>>
>> which means that there is not check if an artifacts is already attached.
>>
>> This means two things from my point of view:
>>
>> Change the maven-core (checking for duplicate attaches) and furthermore
>> plugins which are adding this should check themself if the artifact
>> already exist?
>>
>> WDYT ? Better idea/suggestions ?
>>
>>
>> Kind regards
>> Karl Heinz Marbaise
>>
>> https://issues.apache.org/jira/browse/MNG-5868
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>>
>
>
> Mit freundlichem Gruß
> Karl-Heinz Marbaise
> --
> SoftwareEntwicklung Beratung Schulung Tel.: +49 (0) 2405 / 415 893
> Dipl.Ing.(FH) Karl-Heinz Marbaise USt.IdNr: DE191347579
> Hauptstrasse 177
> 52146 Würselen http://www.soebes.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
Thanks,
Jason
----------------------------------------------------------
Jason van Zyl
Founder, Takari and Apache Maven
http://twitter.com/jvanzyl
http://twitter.com/takari_io
---------------------------------------------------------
People develop abstractions by generalizing from concrete examples.
Every attempt to determine the correct abstraction on paper without
actually developing a running system is doomed to failure. No one
is that smart. A framework is a resuable design, so you develop it by
looking at the things it is supposed to be a design of. The more examples
you look at, the more general your framework will be.
-- Ralph Johnson & Don Roberts, Patterns for Evolving Frameworks
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: https://issues.apache.org/jira/browse/MSHADE-195
Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi,
someone ?
On 8/9/15 3:21 PM, Karl Heinz Marbaise wrote:
> Hi,
>
> After diving into the above issue i stumbled over several things...
>
> If you take a look here and the log output excerpt:
>
> INFO] Minimized 2341 -> 1293
> [INFO] Minimized 3282 -> 2234
> [INFO] Replacing original artifact with shaded artifact.
> [INFO] Replacing
> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT.jar
> with
> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-shaded.jar
>
> [INFO] Replacing original source artifact with shaded source artifact.
> [INFO] Replacing
> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-sources.jar
> with
> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-shaded-sources.jar
>
> [INFO] Dependency-reduced POM written at:
> /Users/kama/ws-git/apache/mshade/mshade-195/dependency-reduced-pom.xml
> [INFO]
> [INFO] --- maven-install-plugin:2.5.2:install (default-install) @
> MSHADE-195-example ---
> [INFO] Installing
> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT.jar
> to
> /Users/kama/.m2/repository/com/example/MSHADE-195-example/1-SNAPSHOT/MSHADE-195-example-1-SNAPSHOT.jar
>
> [INFO] Installing
> /Users/kama/ws-git/apache/mshade/mshade-195/dependency-reduced-pom.xml
> to
> /Users/kama/.m2/repository/com/example/MSHADE-195-example/1-SNAPSHOT/MSHADE-195-example-1-SNAPSHOT.pom
>
> [INFO] Installing
> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-sources.jar
> to
> /Users/kama/.m2/repository/com/example/MSHADE-195-example/1-SNAPSHOT/MSHADE-195-example-1-SNAPSHOT-sources.jar
>
> [INFO] Installing
> /Users/kama/ws-git/apache/mshade/mshade-195/target/MSHADE-195-example-1-SNAPSHOT-sources.jar
> to
> /Users/kama/.m2/repository/com/example/MSHADE-195-example/1-SNAPSHOT/MSHADE-195-example-1-SNAPSHOT-sources.jar
>
> [INFO]
>
> Install plugin tries to install two identical artifacts which will work
> for maven-install-plugin but would fail for a deploy to a repository
> manager (releases? etc.
>
> So after diving into the problem i found the following code in
> maven-core (MavenProject.java):
>
> /**
> * Add or replace an artifact. This method is now deprecated. Use
> the @{MavenProjectHelper} to attach artifacts to a
> * project. In spite of the 'throws' declaration on this API, this
> method has never thrown an exception since Maven
> * 3.0.x. Historically, it logged and ignored a second addition of
> the same g/a/v/c/t. Now it replaces the file for
> * the artifact, so that plugins (e.g. shade) can change the
> pathname of the file for a particular set of
> * coordinates.
> *
> * @param artifact the artifact to add or replace.
> * @throws DuplicateArtifactAttachmentException
> */
> public void addAttachedArtifact( Artifact artifact )
> throws DuplicateArtifactAttachmentException
> {
> getAttachedArtifacts().add( artifact );
> }
>
> public List<Artifact> getAttachedArtifacts()
> {
> if ( attachedArtifacts == null )
> {
> attachedArtifacts = new ArrayList<>();
> }
> return attachedArtifacts;
> }
>
> So taking a look into MavenProjectHelper.java and the implementation
> (DefaultMavenProjectHelper.java).
>
> /**
> * Add an attached artifact or replace the file for an existing
> artifact.
> *
> * @see
> MavenProject#addAttachedArtifact(org.apache.maven.artifact.Artifact)
> * @param project project reference.
> * @param artifact artifact to add or replace.
> */
> public void attachArtifact( MavenProject project, Artifact artifact )
> {
> project.addAttachedArtifact( artifact );
> }
>
>
> which means that there is not check if an artifacts is already attached.
>
> This means two things from my point of view:
>
> Change the maven-core (checking for duplicate attaches) and furthermore
> plugins which are adding this should check themself if the artifact
> already exist?
>
> WDYT ? Better idea/suggestions ?
>
>
> Kind regards
> Karl Heinz Marbaise
>
> https://issues.apache.org/jira/browse/MNG-5868
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
Mit freundlichem Gruß
Karl-Heinz Marbaise
--
SoftwareEntwicklung Beratung Schulung Tel.: +49 (0) 2405 / 415 893
Dipl.Ing.(FH) Karl-Heinz Marbaise USt.IdNr: DE191347579
Hauptstrasse 177
52146 Würselen http://www.soebes.de
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org