You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Benson Margulies <bi...@gmail.com> on 2015/02/02 15:43:44 UTC

Plexus versus maven-artifact-manager

I'm attempting to pull archetype up to 2.2.1. I seem to have found a
disagreement between 2.2.1 of maven-artifact-manager and some version
of some part of plexus.

Is this a familiar story to anyone; is there, for example, some plexus
piece I need a different version of?

DefaultArtifactTransfomationManager has ...

public void initialize() throws InitializationException {
   // TODO this is a hack until plexus can fix the ordering of the arrays
   ArtifactTransformation transforms[] =
artifactTransformations.toArray( new ArtifactTransformation[]{} );
   for (int x = 0; x < transforms.length; x++)
   {
      if (transforms[x].getClass().getName().indexOf("Snapshot") != -1) {
         artifactTransformations.remove(transforms[x]);
         artifactTransformations.add(transforms[x]);
      }
   }
}

Resulting in

Caused by: java.lang.UnsupportedOperationException: You cannot modify
this list. This list is a requirement of role:
'org.apache.maven.artifact.transform.ArtifactTransformationManager',
implementation:
'org.apache.maven.artifact.transform.DefaultArtifactTransformationManager',
role hint: 'default' and managed by the container.
at org.codehaus.plexus.component.collections.ComponentList.remove(ComponentList.java:91)
at org.apache.maven.artifact.transform.DefaultArtifactTransformationManager.initialize(DefaultArtifactTransformationManager.java:44)
at org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializePhase.execute(InitializePhase.java:33)
at org.codehaus.plexus.lifecycle.AbstractLifecycleHandler.start(AbstractLifecycleHandler.java:96)
at org.codehaus.plexus.component.manager.AbstractComponentManager.start(AbstractComponentManager.java:167)
at org.codehaus.plexus.component.builder.XBeanComponentBuilder.startComponentLifecycle(XBeanComponentBuilder.java:283)
at org.codehaus.plexus.component.builder.XBeanComponentBuilder.build(XBeanComponentBuilder.java:129)
at org.codehaus.plexus.component.manager.AbstractComponentManager.createComponentInstance(AbstractComponentManager.java:181)
at org.codehaus.plexus.component.manager.SingletonComponentManager.getComponent(SingletonComponentManager.java:67)
at org.codehaus.plexus.DefaultComponentRegistry.getComponent(DefaultComponentRegistry.java:358)
at org.codehaus.plexus.DefaultComponentRegistry.lookup(DefaultComponentRegistry.java:178)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:393)
at org.codehaus.plexus.component.builder.XBeanComponentBuilder$RequirementRecipe.internalCreate(XBeanComponentBuilder.java:402)
at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
at org.apache.xbean.recipe.RecipeHelper.convert(RecipeHelper.java:167)
at org.apache.xbean.recipe.ObjectRecipe.setProperty(ObjectRecipe.java:497)
... 79 more

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


Re: Plexus versus maven-artifact-manager

Posted by Stuart McCulloch <mc...@gmail.com>.
On Monday, 2 February 2015 at 14:43, Benson Margulies wrote:
> I'm attempting to pull archetype up to 2.2.1. I seem to have found a
> disagreement between 2.2.1 of maven-artifact-manager and some version
> of some part of plexus.
>  
> Is this a familiar story to anyone; is there, for example, some plexus
> piece I need a different version of?
>  
>  

The 2.2.1 version of DefaultArtifactTransformationManager (from maven-artifact-manager, a transitive dependency of maven-core 2.x) is attempting to mutate a managed/read-only collection. You could get away with this in Plexus 1.0-alpha-9-stable-1 because it just happened to expose the underlying mutable collection. This is not allowed in later versions of both Plexus and the Guice-Plexus shim. Ideally it should use its own collection to do the local mutation/filtering, but since there won’t be any more releases of that particular module then you need to test it with the old container.

Note that the maven-artifact-manager API (a transitive dependency of maven-core) is gone in Maven3 - it was moved into the maven-compat module and subsequently moved to a different package:

https://github.com/apache/maven/commit/ee5dd78bd1a0b96edf2cc53480b342bb74b9a173

https://jira.codehaus.org/browse/MNG-4221

So this won’t cause any issues at runtime since Maven filters out core dependencies, it’s just at test-time that you have to be careful about keeping the versions of maven and the container in sync.
> DefaultArtifactTransfomationManager has ...
>  
> public void initialize() throws InitializationException {
> // TODO this is a hack until plexus can fix the ordering of the arrays
> ArtifactTransformation transforms[] =
> artifactTransformations.toArray( new ArtifactTransformation[]{} );
> for (int x = 0; x < transforms.length; x++)
> {
> if (transforms[x].getClass().getName().indexOf("Snapshot") != -1) {
> artifactTransformations.remove(transforms[x]);
> artifactTransformations.add(transforms[x]);
> }
> }
> }
>  
> Resulting in
>  
> Caused by: java.lang.UnsupportedOperationException: You cannot modify
> this list. This list is a requirement of role:
> 'org.apache.maven.artifact.transform.ArtifactTransformationManager',
> implementation:
> 'org.apache.maven.artifact.transform.DefaultArtifactTransformationManager',
> role hint: 'default' and managed by the container.
> at org.codehaus.plexus.component.collections.ComponentList.remove(ComponentList.java:91)
> at org.apache.maven.artifact.transform.DefaultArtifactTransformationManager.initialize(DefaultArtifactTransformationManager.java:44)
> at org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializePhase.execute(InitializePhase.java:33)
> at org.codehaus.plexus.lifecycle.AbstractLifecycleHandler.start(AbstractLifecycleHandler.java:96)
> at org.codehaus.plexus.component.manager.AbstractComponentManager.start(AbstractComponentManager.java:167)
> at org.codehaus.plexus.component.builder.XBeanComponentBuilder.startComponentLifecycle(XBeanComponentBuilder.java:283)
> at org.codehaus.plexus.component.builder.XBeanComponentBuilder.build(XBeanComponentBuilder.java:129)
> at org.codehaus.plexus.component.manager.AbstractComponentManager.createComponentInstance(AbstractComponentManager.java:181)
> at org.codehaus.plexus.component.manager.SingletonComponentManager.getComponent(SingletonComponentManager.java:67)
> at org.codehaus.plexus.DefaultComponentRegistry.getComponent(DefaultComponentRegistry.java:358)
> at org.codehaus.plexus.DefaultComponentRegistry.lookup(DefaultComponentRegistry.java:178)
> at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:393)
> at org.codehaus.plexus.component.builder.XBeanComponentBuilder$RequirementRecipe.internalCreate(XBeanComponentBuilder.java:402)
> at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
> at org.apache.xbean.recipe.RecipeHelper.convert(RecipeHelper.java:167)
> at org.apache.xbean.recipe.ObjectRecipe.setProperty(ObjectRecipe.java:497)
> ... 79 more
>  
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org (mailto:dev-unsubscribe@maven.apache.org)
> For additional commands, e-mail: dev-help@maven.apache.org (mailto:dev-help@maven.apache.org)
>  
>  



Re: Plexus versus maven-artifact-manager

Posted by Benson Margulies <bi...@gmail.com>.
So all is well with 1.0-alpha-9-stable-1, of plexus-container-default,
but nothing newer! I suppose that I should keep that dependency for
the release at the 2.2.1 level, and then reconsider things.


On Mon, Feb 2, 2015 at 9:43 AM, Benson Margulies <bi...@gmail.com> wrote:
> I'm attempting to pull archetype up to 2.2.1. I seem to have found a
> disagreement between 2.2.1 of maven-artifact-manager and some version
> of some part of plexus.
>
> Is this a familiar story to anyone; is there, for example, some plexus
> piece I need a different version of?
>
> DefaultArtifactTransfomationManager has ...
>
> public void initialize() throws InitializationException {
>    // TODO this is a hack until plexus can fix the ordering of the arrays
>    ArtifactTransformation transforms[] =
> artifactTransformations.toArray( new ArtifactTransformation[]{} );
>    for (int x = 0; x < transforms.length; x++)
>    {
>       if (transforms[x].getClass().getName().indexOf("Snapshot") != -1) {
>          artifactTransformations.remove(transforms[x]);
>          artifactTransformations.add(transforms[x]);
>       }
>    }
> }
>
> Resulting in
>
> Caused by: java.lang.UnsupportedOperationException: You cannot modify
> this list. This list is a requirement of role:
> 'org.apache.maven.artifact.transform.ArtifactTransformationManager',
> implementation:
> 'org.apache.maven.artifact.transform.DefaultArtifactTransformationManager',
> role hint: 'default' and managed by the container.
> at org.codehaus.plexus.component.collections.ComponentList.remove(ComponentList.java:91)
> at org.apache.maven.artifact.transform.DefaultArtifactTransformationManager.initialize(DefaultArtifactTransformationManager.java:44)
> at org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializePhase.execute(InitializePhase.java:33)
> at org.codehaus.plexus.lifecycle.AbstractLifecycleHandler.start(AbstractLifecycleHandler.java:96)
> at org.codehaus.plexus.component.manager.AbstractComponentManager.start(AbstractComponentManager.java:167)
> at org.codehaus.plexus.component.builder.XBeanComponentBuilder.startComponentLifecycle(XBeanComponentBuilder.java:283)
> at org.codehaus.plexus.component.builder.XBeanComponentBuilder.build(XBeanComponentBuilder.java:129)
> at org.codehaus.plexus.component.manager.AbstractComponentManager.createComponentInstance(AbstractComponentManager.java:181)
> at org.codehaus.plexus.component.manager.SingletonComponentManager.getComponent(SingletonComponentManager.java:67)
> at org.codehaus.plexus.DefaultComponentRegistry.getComponent(DefaultComponentRegistry.java:358)
> at org.codehaus.plexus.DefaultComponentRegistry.lookup(DefaultComponentRegistry.java:178)
> at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:393)
> at org.codehaus.plexus.component.builder.XBeanComponentBuilder$RequirementRecipe.internalCreate(XBeanComponentBuilder.java:402)
> at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
> at org.apache.xbean.recipe.RecipeHelper.convert(RecipeHelper.java:167)
> at org.apache.xbean.recipe.ObjectRecipe.setProperty(ObjectRecipe.java:497)
> ... 79 more

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