You are viewing a plain text version of this content. The canonical link for it is here.
Posted to npanday-commits@incubator.apache.org by "sergio rupena (Created) (JIRA)" <ji...@apache.org> on 2011/10/18 22:05:10 UTC
[jira] [Created] (NPANDAY-473) compatibilty with maven 3
compatibilty with maven 3
-------------------------
Key: NPANDAY-473
URL: https://issues.apache.org/jira/browse/NPANDAY-473
Project: NPanday
Issue Type: Bug
Components: Maven Plugins
Affects Versions: 1.4.1-incubating
Environment: maven 3, 64 bit windows 7, jre 1.6.0.22
Reporter: sergio rupena
I get this error when I run maven 3 with npanday:
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT:initialize (default-initialize) on project TestDll: Execution default-initialize of goal org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT:initialize failed: An API incompatibility was encountered while executing org.apache.npanday.plugins:maven-
compile-plugin:1.4.1-incubating-SNAPSHOT:initialize: java.lang.NoSuchMethodError: org.apache.maven.artifact.ArtifactUtils.artifactMapByArtifactId(Ljava/util/Collection;)Ljava/util/Map;
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/sr/.m2/repository/org/apache/npanday/plugins/maven-compile-plugin/1.4.1-incubating-SNAPSHOT/maven-compile-plugin-1.4.1-incubating-SNAPSHOT.jar
[ERROR] urls[1] = file:/C:/Users/sr/.m2/repository/org/apache/npanday/dotnet-registry/1.4.1-incubating-SNAPSHOT/dotnet-registry-1.4.1-incubating-SNAPSHOT.jar
[ERROR] urls[2] = file:/C:/Users/sr/.m2/repository/net/sf/kxml/kxml2/2.1.8/kxml2-2.1.8.jar
[ERROR] urls[3] = file:/C:/Users/sr/.m2/repository/xmlpull/xmlpull/1.1.3.4a/xmlpull-1.1.3.4a.jar
[ERROR] urls[4] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-repository-api/2.0-beta5/openrdf-repository-api-2.0-beta5.jar
[ERROR] urls[5] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-query/2.0-beta5/openrdf-query-2.0-beta5.jar
[ERROR] urls[6] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-sail-api/2.0-beta5/openrdf-sail-api-2.0-beta5.jar
[ERROR] urls[7] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-queryresultio-api/2.0-beta5/openrdf-queryresultio-api-2.0-beta5.jar
[ERROR] urls[8] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-rio-api/2.0-beta5/openrdf-rio-api-2.0-beta5.jar
[ERROR] urls[9] = file:/C:/Users/sr/.m2/repository/info/aduna/aduna-xml/1.2/aduna-xml-1.2.jar
[ERROR] urls[10] = file:/C:/Users/sr/.m2/repository/info/aduna/aduna-lang/1.3/aduna-lang-1.3.jar
It looks like the java class AssemblyResolverImpl.java. (from the dotnet-artifact project) can only use the maven 2 API.
I tried the following workaround just to see if I could get it work with maven 3. I post it here as hack, as it's using reflection to fallback to the maven 3 api.
{code}
private Map<String, Artifact> artifactMapByArtifactId(java.util.Collection<Artifact> artifacts){
try{
for(java.lang.reflect.Method method : ArtifactUtils.class.getDeclaredMethods()){
if (method.getName() == "artifactMapByVersionlessId"){
return (Map<String, Artifact>)method.invoke(null, new Object[]{artifacts});
}
}
} catch(java.lang.IllegalAccessException e){
throw new RuntimeException("failed to map artifacts using ArtifactUtils class", e);
}catch(java.lang.reflect.InvocationTargetException e){
throw new RuntimeException("failed to map artifacts using ArtifactUtils class", e);
}
return ArtifactUtils.artifactMapByArtifactId( Collections.singleton( artifacts )) ;
}
public void resolve(Artifact artifact, List remoteRepositories, ArtifactRepository localRepository) throws ArtifactResolutionException, ArtifactNotFoundException
{
String mavenProjectRefId = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion();
MavenProject mavenProjectRef = (MavenProject) mavenProjectRefs.get( mavenProjectRefId );
if ( mavenProjectRef != null )
{
if ( "pom".equals( artifact.getType() ) )
{
artifact.setFile( mavenProjectRef.getFile() );
return;
}
else
{
Map artifactMapByArtifactId = new HashMap();
artifactMapByArtifactId.putAll( artifactMapByArtifactId( Collections.singleton( mavenProjectRef.getArtifact() ) ) );
artifactMapByArtifactId.putAll( artifactMapByArtifactId( mavenProjectRef.getArtifacts() ) );
artifactMapByArtifactId.putAll( artifactMapByArtifactId( mavenProjectRef.getAttachedArtifacts() ) );
Artifact projectArtifact = (Artifact) artifactMapByArtifactId.get( artifact.getId() );
if ( projectArtifact != null )
{
artifact.setFile( projectArtifact.getFile() );
return;
}
}
}
delegate.resolve( artifact, remoteRepositories, localRepository );
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (NPANDAY-473) compatibilty with maven 3
Posted by "Lars Corneliussen (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/NPANDAY-473?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13151289#comment-13151289 ]
Lars Corneliussen commented on NPANDAY-473:
-------------------------------------------
Hi. Encountering the same error and would like to fix it! Seems like it got introduced with mvn 3.0.3, since I already successfully built with 3.0.0-alpha or so..
But I might be wrong.
Did you check, if there is any solution without using reflection?
> compatibilty with maven 3
> -------------------------
>
> Key: NPANDAY-473
> URL: https://issues.apache.org/jira/browse/NPANDAY-473
> Project: NPanday
> Issue Type: Bug
> Components: Maven Plugins
> Affects Versions: 1.4.1-incubating
> Environment: maven 3, 64 bit windows 7, jre 1.6.0.22
> Reporter: sergio rupena
>
> I get this error when I run maven 3 with npanday:
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT:initialize (default-initialize) on project TestDll: Execution default-initialize of goal org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT:initialize failed: An API incompatibility was encountered while executing org.apache.npanday.plugins:maven-
> compile-plugin:1.4.1-incubating-SNAPSHOT:initialize: java.lang.NoSuchMethodError: org.apache.maven.artifact.ArtifactUtils.artifactMapByArtifactId(Ljava/util/Collection;)Ljava/util/Map;
> [ERROR] -----------------------------------------------------
> [ERROR] realm = plugin>org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT
> [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
> [ERROR] urls[0] = file:/C:/Users/sr/.m2/repository/org/apache/npanday/plugins/maven-compile-plugin/1.4.1-incubating-SNAPSHOT/maven-compile-plugin-1.4.1-incubating-SNAPSHOT.jar
> [ERROR] urls[1] = file:/C:/Users/sr/.m2/repository/org/apache/npanday/dotnet-registry/1.4.1-incubating-SNAPSHOT/dotnet-registry-1.4.1-incubating-SNAPSHOT.jar
> [ERROR] urls[2] = file:/C:/Users/sr/.m2/repository/net/sf/kxml/kxml2/2.1.8/kxml2-2.1.8.jar
> [ERROR] urls[3] = file:/C:/Users/sr/.m2/repository/xmlpull/xmlpull/1.1.3.4a/xmlpull-1.1.3.4a.jar
> [ERROR] urls[4] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-repository-api/2.0-beta5/openrdf-repository-api-2.0-beta5.jar
> [ERROR] urls[5] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-query/2.0-beta5/openrdf-query-2.0-beta5.jar
> [ERROR] urls[6] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-sail-api/2.0-beta5/openrdf-sail-api-2.0-beta5.jar
> [ERROR] urls[7] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-queryresultio-api/2.0-beta5/openrdf-queryresultio-api-2.0-beta5.jar
> [ERROR] urls[8] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-rio-api/2.0-beta5/openrdf-rio-api-2.0-beta5.jar
> [ERROR] urls[9] = file:/C:/Users/sr/.m2/repository/info/aduna/aduna-xml/1.2/aduna-xml-1.2.jar
> [ERROR] urls[10] = file:/C:/Users/sr/.m2/repository/info/aduna/aduna-lang/1.3/aduna-lang-1.3.jar
> It looks like the java class AssemblyResolverImpl.java. (from the dotnet-artifact project) can only use the maven 2 API.
> I tried the following workaround just to see if I could get it work with maven 3. I post it here as hack, as it's using reflection to fallback to the maven 3 api.
> {code}
> private Map<String, Artifact> artifactMapByArtifactId(java.util.Collection<Artifact> artifacts){
> try{
> for(java.lang.reflect.Method method : ArtifactUtils.class.getDeclaredMethods()){
> if (method.getName() == "artifactMapByVersionlessId"){
> return (Map<String, Artifact>)method.invoke(null, new Object[]{artifacts});
> }
> }
> } catch(java.lang.IllegalAccessException e){
> throw new RuntimeException("failed to map artifacts using ArtifactUtils class", e);
> }catch(java.lang.reflect.InvocationTargetException e){
> throw new RuntimeException("failed to map artifacts using ArtifactUtils class", e);
> }
> return ArtifactUtils.artifactMapByArtifactId( Collections.singleton( artifacts )) ;
> }
> public void resolve(Artifact artifact, List remoteRepositories, ArtifactRepository localRepository) throws ArtifactResolutionException, ArtifactNotFoundException
> {
>
> String mavenProjectRefId = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion();
> MavenProject mavenProjectRef = (MavenProject) mavenProjectRefs.get( mavenProjectRefId );
> if ( mavenProjectRef != null )
> {
> if ( "pom".equals( artifact.getType() ) )
> {
> artifact.setFile( mavenProjectRef.getFile() );
> return;
> }
> else
> {
> Map artifactMapByArtifactId = new HashMap();
> artifactMapByArtifactId.putAll( artifactMapByArtifactId( Collections.singleton( mavenProjectRef.getArtifact() ) ) );
> artifactMapByArtifactId.putAll( artifactMapByArtifactId( mavenProjectRef.getArtifacts() ) );
> artifactMapByArtifactId.putAll( artifactMapByArtifactId( mavenProjectRef.getAttachedArtifacts() ) );
> Artifact projectArtifact = (Artifact) artifactMapByArtifactId.get( artifact.getId() );
> if ( projectArtifact != null )
> {
> artifact.setFile( projectArtifact.getFile() );
> return;
> }
> }
> }
> delegate.resolve( artifact, remoteRepositories, localRepository );
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (NPANDAY-473) compatibilty with maven 3
Posted by "Lars Corneliussen (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/NPANDAY-473?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13151299#comment-13151299 ]
Lars Corneliussen commented on NPANDAY-473:
-------------------------------------------
As i see it 'artifactMapByVersionlessId' exists in all versions, and does the same.
> compatibilty with maven 3
> -------------------------
>
> Key: NPANDAY-473
> URL: https://issues.apache.org/jira/browse/NPANDAY-473
> Project: NPanday
> Issue Type: Bug
> Components: Maven Plugins
> Affects Versions: 1.4.1-incubating
> Environment: maven 3, 64 bit windows 7, jre 1.6.0.22
> Reporter: sergio rupena
>
> I get this error when I run maven 3 with npanday:
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT:initialize (default-initialize) on project TestDll: Execution default-initialize of goal org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT:initialize failed: An API incompatibility was encountered while executing org.apache.npanday.plugins:maven-
> compile-plugin:1.4.1-incubating-SNAPSHOT:initialize: java.lang.NoSuchMethodError: org.apache.maven.artifact.ArtifactUtils.artifactMapByArtifactId(Ljava/util/Collection;)Ljava/util/Map;
> [ERROR] -----------------------------------------------------
> [ERROR] realm = plugin>org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT
> [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
> [ERROR] urls[0] = file:/C:/Users/sr/.m2/repository/org/apache/npanday/plugins/maven-compile-plugin/1.4.1-incubating-SNAPSHOT/maven-compile-plugin-1.4.1-incubating-SNAPSHOT.jar
> [ERROR] urls[1] = file:/C:/Users/sr/.m2/repository/org/apache/npanday/dotnet-registry/1.4.1-incubating-SNAPSHOT/dotnet-registry-1.4.1-incubating-SNAPSHOT.jar
> [ERROR] urls[2] = file:/C:/Users/sr/.m2/repository/net/sf/kxml/kxml2/2.1.8/kxml2-2.1.8.jar
> [ERROR] urls[3] = file:/C:/Users/sr/.m2/repository/xmlpull/xmlpull/1.1.3.4a/xmlpull-1.1.3.4a.jar
> [ERROR] urls[4] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-repository-api/2.0-beta5/openrdf-repository-api-2.0-beta5.jar
> [ERROR] urls[5] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-query/2.0-beta5/openrdf-query-2.0-beta5.jar
> [ERROR] urls[6] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-sail-api/2.0-beta5/openrdf-sail-api-2.0-beta5.jar
> [ERROR] urls[7] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-queryresultio-api/2.0-beta5/openrdf-queryresultio-api-2.0-beta5.jar
> [ERROR] urls[8] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-rio-api/2.0-beta5/openrdf-rio-api-2.0-beta5.jar
> [ERROR] urls[9] = file:/C:/Users/sr/.m2/repository/info/aduna/aduna-xml/1.2/aduna-xml-1.2.jar
> [ERROR] urls[10] = file:/C:/Users/sr/.m2/repository/info/aduna/aduna-lang/1.3/aduna-lang-1.3.jar
> It looks like the java class AssemblyResolverImpl.java. (from the dotnet-artifact project) can only use the maven 2 API.
> I tried the following workaround just to see if I could get it work with maven 3. I post it here as hack, as it's using reflection to fallback to the maven 3 api.
> {code}
> private Map<String, Artifact> artifactMapByArtifactId(java.util.Collection<Artifact> artifacts){
> try{
> for(java.lang.reflect.Method method : ArtifactUtils.class.getDeclaredMethods()){
> if (method.getName() == "artifactMapByVersionlessId"){
> return (Map<String, Artifact>)method.invoke(null, new Object[]{artifacts});
> }
> }
> } catch(java.lang.IllegalAccessException e){
> throw new RuntimeException("failed to map artifacts using ArtifactUtils class", e);
> }catch(java.lang.reflect.InvocationTargetException e){
> throw new RuntimeException("failed to map artifacts using ArtifactUtils class", e);
> }
> return ArtifactUtils.artifactMapByArtifactId( Collections.singleton( artifacts )) ;
> }
> public void resolve(Artifact artifact, List remoteRepositories, ArtifactRepository localRepository) throws ArtifactResolutionException, ArtifactNotFoundException
> {
>
> String mavenProjectRefId = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion();
> MavenProject mavenProjectRef = (MavenProject) mavenProjectRefs.get( mavenProjectRefId );
> if ( mavenProjectRef != null )
> {
> if ( "pom".equals( artifact.getType() ) )
> {
> artifact.setFile( mavenProjectRef.getFile() );
> return;
> }
> else
> {
> Map artifactMapByArtifactId = new HashMap();
> artifactMapByArtifactId.putAll( artifactMapByArtifactId( Collections.singleton( mavenProjectRef.getArtifact() ) ) );
> artifactMapByArtifactId.putAll( artifactMapByArtifactId( mavenProjectRef.getArtifacts() ) );
> artifactMapByArtifactId.putAll( artifactMapByArtifactId( mavenProjectRef.getAttachedArtifacts() ) );
> Artifact projectArtifact = (Artifact) artifactMapByArtifactId.get( artifact.getId() );
> if ( projectArtifact != null )
> {
> artifact.setFile( projectArtifact.getFile() );
> return;
> }
> }
> }
> delegate.resolve( artifact, remoteRepositories, localRepository );
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (NPANDAY-473) NoSuchMethodError: Maven 3 does not
contain method ArtifactUtils.artifactMapByArtifactId
Posted by "Lars Corneliussen (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/NPANDAY-473?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lars Corneliussen updated NPANDAY-473:
--------------------------------------
Summary: NoSuchMethodError: Maven 3 does not contain method ArtifactUtils.artifactMapByArtifactId (was: compatibilty with maven 3)
> NoSuchMethodError: Maven 3 does not contain method ArtifactUtils.artifactMapByArtifactId
> ----------------------------------------------------------------------------------------
>
> Key: NPANDAY-473
> URL: https://issues.apache.org/jira/browse/NPANDAY-473
> Project: NPanday
> Issue Type: Bug
> Components: Maven Plugins
> Affects Versions: 1.4.1-incubating
> Environment: maven 3, 64 bit windows 7, jre 1.6.0.22
> Reporter: sergio rupena
>
> I get this error when I run maven 3 with npanday:
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT:initialize (default-initialize) on project TestDll: Execution default-initialize of goal org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT:initialize failed: An API incompatibility was encountered while executing org.apache.npanday.plugins:maven-
> compile-plugin:1.4.1-incubating-SNAPSHOT:initialize: java.lang.NoSuchMethodError: org.apache.maven.artifact.ArtifactUtils.artifactMapByArtifactId(Ljava/util/Collection;)Ljava/util/Map;
> [ERROR] -----------------------------------------------------
> [ERROR] realm = plugin>org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT
> [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
> [ERROR] urls[0] = file:/C:/Users/sr/.m2/repository/org/apache/npanday/plugins/maven-compile-plugin/1.4.1-incubating-SNAPSHOT/maven-compile-plugin-1.4.1-incubating-SNAPSHOT.jar
> [ERROR] urls[1] = file:/C:/Users/sr/.m2/repository/org/apache/npanday/dotnet-registry/1.4.1-incubating-SNAPSHOT/dotnet-registry-1.4.1-incubating-SNAPSHOT.jar
> [ERROR] urls[2] = file:/C:/Users/sr/.m2/repository/net/sf/kxml/kxml2/2.1.8/kxml2-2.1.8.jar
> [ERROR] urls[3] = file:/C:/Users/sr/.m2/repository/xmlpull/xmlpull/1.1.3.4a/xmlpull-1.1.3.4a.jar
> [ERROR] urls[4] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-repository-api/2.0-beta5/openrdf-repository-api-2.0-beta5.jar
> [ERROR] urls[5] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-query/2.0-beta5/openrdf-query-2.0-beta5.jar
> [ERROR] urls[6] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-sail-api/2.0-beta5/openrdf-sail-api-2.0-beta5.jar
> [ERROR] urls[7] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-queryresultio-api/2.0-beta5/openrdf-queryresultio-api-2.0-beta5.jar
> [ERROR] urls[8] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-rio-api/2.0-beta5/openrdf-rio-api-2.0-beta5.jar
> [ERROR] urls[9] = file:/C:/Users/sr/.m2/repository/info/aduna/aduna-xml/1.2/aduna-xml-1.2.jar
> [ERROR] urls[10] = file:/C:/Users/sr/.m2/repository/info/aduna/aduna-lang/1.3/aduna-lang-1.3.jar
> It looks like the java class AssemblyResolverImpl.java. (from the dotnet-artifact project) can only use the maven 2 API.
> I tried the following workaround just to see if I could get it work with maven 3. I post it here as hack, as it's using reflection to fallback to the maven 3 api.
> {code}
> private Map<String, Artifact> artifactMapByArtifactId(java.util.Collection<Artifact> artifacts){
> try{
> for(java.lang.reflect.Method method : ArtifactUtils.class.getDeclaredMethods()){
> if (method.getName() == "artifactMapByVersionlessId"){
> return (Map<String, Artifact>)method.invoke(null, new Object[]{artifacts});
> }
> }
> } catch(java.lang.IllegalAccessException e){
> throw new RuntimeException("failed to map artifacts using ArtifactUtils class", e);
> }catch(java.lang.reflect.InvocationTargetException e){
> throw new RuntimeException("failed to map artifacts using ArtifactUtils class", e);
> }
> return ArtifactUtils.artifactMapByArtifactId( Collections.singleton( artifacts )) ;
> }
> public void resolve(Artifact artifact, List remoteRepositories, ArtifactRepository localRepository) throws ArtifactResolutionException, ArtifactNotFoundException
> {
>
> String mavenProjectRefId = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion();
> MavenProject mavenProjectRef = (MavenProject) mavenProjectRefs.get( mavenProjectRefId );
> if ( mavenProjectRef != null )
> {
> if ( "pom".equals( artifact.getType() ) )
> {
> artifact.setFile( mavenProjectRef.getFile() );
> return;
> }
> else
> {
> Map artifactMapByArtifactId = new HashMap();
> artifactMapByArtifactId.putAll( artifactMapByArtifactId( Collections.singleton( mavenProjectRef.getArtifact() ) ) );
> artifactMapByArtifactId.putAll( artifactMapByArtifactId( mavenProjectRef.getArtifacts() ) );
> artifactMapByArtifactId.putAll( artifactMapByArtifactId( mavenProjectRef.getAttachedArtifacts() ) );
> Artifact projectArtifact = (Artifact) artifactMapByArtifactId.get( artifact.getId() );
> if ( projectArtifact != null )
> {
> artifact.setFile( projectArtifact.getFile() );
> return;
> }
> }
> }
> delegate.resolve( artifact, remoteRepositories, localRepository );
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (NPANDAY-473) NoSuchMethodError: Maven 3 does not
contain method ArtifactUtils.artifactMapByArtifactId
Posted by "Lars Corneliussen (Resolved) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/NPANDAY-473?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lars Corneliussen resolved NPANDAY-473.
---------------------------------------
Resolution: Fixed
artifactMapByVersionlessId works in both Maven 2 and Maven 3
> NoSuchMethodError: Maven 3 does not contain method ArtifactUtils.artifactMapByArtifactId
> ----------------------------------------------------------------------------------------
>
> Key: NPANDAY-473
> URL: https://issues.apache.org/jira/browse/NPANDAY-473
> Project: NPanday
> Issue Type: Bug
> Components: Maven Plugins
> Affects Versions: 1.4.1-incubating
> Environment: maven 3, 64 bit windows 7, jre 1.6.0.22
> Reporter: sergio rupena
> Assignee: Lars Corneliussen
> Fix For: 1.4.1-incubating
>
>
> I get this error when I run maven 3 with npanday:
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT:initialize (default-initialize) on project TestDll: Execution default-initialize of goal org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT:initialize failed: An API incompatibility was encountered while executing org.apache.npanday.plugins:maven-
> compile-plugin:1.4.1-incubating-SNAPSHOT:initialize: java.lang.NoSuchMethodError: org.apache.maven.artifact.ArtifactUtils.artifactMapByArtifactId(Ljava/util/Collection;)Ljava/util/Map;
> [ERROR] -----------------------------------------------------
> [ERROR] realm = plugin>org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT
> [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
> [ERROR] urls[0] = file:/C:/Users/sr/.m2/repository/org/apache/npanday/plugins/maven-compile-plugin/1.4.1-incubating-SNAPSHOT/maven-compile-plugin-1.4.1-incubating-SNAPSHOT.jar
> [ERROR] urls[1] = file:/C:/Users/sr/.m2/repository/org/apache/npanday/dotnet-registry/1.4.1-incubating-SNAPSHOT/dotnet-registry-1.4.1-incubating-SNAPSHOT.jar
> [ERROR] urls[2] = file:/C:/Users/sr/.m2/repository/net/sf/kxml/kxml2/2.1.8/kxml2-2.1.8.jar
> [ERROR] urls[3] = file:/C:/Users/sr/.m2/repository/xmlpull/xmlpull/1.1.3.4a/xmlpull-1.1.3.4a.jar
> [ERROR] urls[4] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-repository-api/2.0-beta5/openrdf-repository-api-2.0-beta5.jar
> [ERROR] urls[5] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-query/2.0-beta5/openrdf-query-2.0-beta5.jar
> [ERROR] urls[6] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-sail-api/2.0-beta5/openrdf-sail-api-2.0-beta5.jar
> [ERROR] urls[7] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-queryresultio-api/2.0-beta5/openrdf-queryresultio-api-2.0-beta5.jar
> [ERROR] urls[8] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-rio-api/2.0-beta5/openrdf-rio-api-2.0-beta5.jar
> [ERROR] urls[9] = file:/C:/Users/sr/.m2/repository/info/aduna/aduna-xml/1.2/aduna-xml-1.2.jar
> [ERROR] urls[10] = file:/C:/Users/sr/.m2/repository/info/aduna/aduna-lang/1.3/aduna-lang-1.3.jar
> It looks like the java class AssemblyResolverImpl.java. (from the dotnet-artifact project) can only use the maven 2 API.
> I tried the following workaround just to see if I could get it work with maven 3. I post it here as hack, as it's using reflection to fallback to the maven 3 api.
> {code}
> private Map<String, Artifact> artifactMapByArtifactId(java.util.Collection<Artifact> artifacts){
> try{
> for(java.lang.reflect.Method method : ArtifactUtils.class.getDeclaredMethods()){
> if (method.getName() == "artifactMapByVersionlessId"){
> return (Map<String, Artifact>)method.invoke(null, new Object[]{artifacts});
> }
> }
> } catch(java.lang.IllegalAccessException e){
> throw new RuntimeException("failed to map artifacts using ArtifactUtils class", e);
> }catch(java.lang.reflect.InvocationTargetException e){
> throw new RuntimeException("failed to map artifacts using ArtifactUtils class", e);
> }
> return ArtifactUtils.artifactMapByArtifactId( Collections.singleton( artifacts )) ;
> }
> public void resolve(Artifact artifact, List remoteRepositories, ArtifactRepository localRepository) throws ArtifactResolutionException, ArtifactNotFoundException
> {
>
> String mavenProjectRefId = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion();
> MavenProject mavenProjectRef = (MavenProject) mavenProjectRefs.get( mavenProjectRefId );
> if ( mavenProjectRef != null )
> {
> if ( "pom".equals( artifact.getType() ) )
> {
> artifact.setFile( mavenProjectRef.getFile() );
> return;
> }
> else
> {
> Map artifactMapByArtifactId = new HashMap();
> artifactMapByArtifactId.putAll( artifactMapByArtifactId( Collections.singleton( mavenProjectRef.getArtifact() ) ) );
> artifactMapByArtifactId.putAll( artifactMapByArtifactId( mavenProjectRef.getArtifacts() ) );
> artifactMapByArtifactId.putAll( artifactMapByArtifactId( mavenProjectRef.getAttachedArtifacts() ) );
> Artifact projectArtifact = (Artifact) artifactMapByArtifactId.get( artifact.getId() );
> if ( projectArtifact != null )
> {
> artifact.setFile( projectArtifact.getFile() );
> return;
> }
> }
> }
> delegate.resolve( artifact, remoteRepositories, localRepository );
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (NPANDAY-473) NoSuchMethodError: Maven 3 does not
contain method ArtifactUtils.artifactMapByArtifactId
Posted by "Lars Corneliussen (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/NPANDAY-473?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lars Corneliussen updated NPANDAY-473:
--------------------------------------
Fix Version/s: 1.4.1-incubating
Assignee: Lars Corneliussen
> NoSuchMethodError: Maven 3 does not contain method ArtifactUtils.artifactMapByArtifactId
> ----------------------------------------------------------------------------------------
>
> Key: NPANDAY-473
> URL: https://issues.apache.org/jira/browse/NPANDAY-473
> Project: NPanday
> Issue Type: Bug
> Components: Maven Plugins
> Affects Versions: 1.4.1-incubating
> Environment: maven 3, 64 bit windows 7, jre 1.6.0.22
> Reporter: sergio rupena
> Assignee: Lars Corneliussen
> Fix For: 1.4.1-incubating
>
>
> I get this error when I run maven 3 with npanday:
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT:initialize (default-initialize) on project TestDll: Execution default-initialize of goal org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT:initialize failed: An API incompatibility was encountered while executing org.apache.npanday.plugins:maven-
> compile-plugin:1.4.1-incubating-SNAPSHOT:initialize: java.lang.NoSuchMethodError: org.apache.maven.artifact.ArtifactUtils.artifactMapByArtifactId(Ljava/util/Collection;)Ljava/util/Map;
> [ERROR] -----------------------------------------------------
> [ERROR] realm = plugin>org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT
> [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
> [ERROR] urls[0] = file:/C:/Users/sr/.m2/repository/org/apache/npanday/plugins/maven-compile-plugin/1.4.1-incubating-SNAPSHOT/maven-compile-plugin-1.4.1-incubating-SNAPSHOT.jar
> [ERROR] urls[1] = file:/C:/Users/sr/.m2/repository/org/apache/npanday/dotnet-registry/1.4.1-incubating-SNAPSHOT/dotnet-registry-1.4.1-incubating-SNAPSHOT.jar
> [ERROR] urls[2] = file:/C:/Users/sr/.m2/repository/net/sf/kxml/kxml2/2.1.8/kxml2-2.1.8.jar
> [ERROR] urls[3] = file:/C:/Users/sr/.m2/repository/xmlpull/xmlpull/1.1.3.4a/xmlpull-1.1.3.4a.jar
> [ERROR] urls[4] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-repository-api/2.0-beta5/openrdf-repository-api-2.0-beta5.jar
> [ERROR] urls[5] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-query/2.0-beta5/openrdf-query-2.0-beta5.jar
> [ERROR] urls[6] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-sail-api/2.0-beta5/openrdf-sail-api-2.0-beta5.jar
> [ERROR] urls[7] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-queryresultio-api/2.0-beta5/openrdf-queryresultio-api-2.0-beta5.jar
> [ERROR] urls[8] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-rio-api/2.0-beta5/openrdf-rio-api-2.0-beta5.jar
> [ERROR] urls[9] = file:/C:/Users/sr/.m2/repository/info/aduna/aduna-xml/1.2/aduna-xml-1.2.jar
> [ERROR] urls[10] = file:/C:/Users/sr/.m2/repository/info/aduna/aduna-lang/1.3/aduna-lang-1.3.jar
> It looks like the java class AssemblyResolverImpl.java. (from the dotnet-artifact project) can only use the maven 2 API.
> I tried the following workaround just to see if I could get it work with maven 3. I post it here as hack, as it's using reflection to fallback to the maven 3 api.
> {code}
> private Map<String, Artifact> artifactMapByArtifactId(java.util.Collection<Artifact> artifacts){
> try{
> for(java.lang.reflect.Method method : ArtifactUtils.class.getDeclaredMethods()){
> if (method.getName() == "artifactMapByVersionlessId"){
> return (Map<String, Artifact>)method.invoke(null, new Object[]{artifacts});
> }
> }
> } catch(java.lang.IllegalAccessException e){
> throw new RuntimeException("failed to map artifacts using ArtifactUtils class", e);
> }catch(java.lang.reflect.InvocationTargetException e){
> throw new RuntimeException("failed to map artifacts using ArtifactUtils class", e);
> }
> return ArtifactUtils.artifactMapByArtifactId( Collections.singleton( artifacts )) ;
> }
> public void resolve(Artifact artifact, List remoteRepositories, ArtifactRepository localRepository) throws ArtifactResolutionException, ArtifactNotFoundException
> {
>
> String mavenProjectRefId = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion();
> MavenProject mavenProjectRef = (MavenProject) mavenProjectRefs.get( mavenProjectRefId );
> if ( mavenProjectRef != null )
> {
> if ( "pom".equals( artifact.getType() ) )
> {
> artifact.setFile( mavenProjectRef.getFile() );
> return;
> }
> else
> {
> Map artifactMapByArtifactId = new HashMap();
> artifactMapByArtifactId.putAll( artifactMapByArtifactId( Collections.singleton( mavenProjectRef.getArtifact() ) ) );
> artifactMapByArtifactId.putAll( artifactMapByArtifactId( mavenProjectRef.getArtifacts() ) );
> artifactMapByArtifactId.putAll( artifactMapByArtifactId( mavenProjectRef.getAttachedArtifacts() ) );
> Artifact projectArtifact = (Artifact) artifactMapByArtifactId.get( artifact.getId() );
> if ( projectArtifact != null )
> {
> artifact.setFile( projectArtifact.getFile() );
> return;
> }
> }
> }
> delegate.resolve( artifact, remoteRepositories, localRepository );
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Work started] (NPANDAY-473) NoSuchMethodError: Maven 3 does
not contain method ArtifactUtils.artifactMapByArtifactId
Posted by "Lars Corneliussen (Work started) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/NPANDAY-473?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Work on NPANDAY-473 started by Lars Corneliussen.
> NoSuchMethodError: Maven 3 does not contain method ArtifactUtils.artifactMapByArtifactId
> ----------------------------------------------------------------------------------------
>
> Key: NPANDAY-473
> URL: https://issues.apache.org/jira/browse/NPANDAY-473
> Project: NPanday
> Issue Type: Bug
> Components: Maven Plugins
> Affects Versions: 1.4.1-incubating
> Environment: maven 3, 64 bit windows 7, jre 1.6.0.22
> Reporter: sergio rupena
> Assignee: Lars Corneliussen
> Fix For: 1.4.1-incubating
>
>
> I get this error when I run maven 3 with npanday:
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT:initialize (default-initialize) on project TestDll: Execution default-initialize of goal org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT:initialize failed: An API incompatibility was encountered while executing org.apache.npanday.plugins:maven-
> compile-plugin:1.4.1-incubating-SNAPSHOT:initialize: java.lang.NoSuchMethodError: org.apache.maven.artifact.ArtifactUtils.artifactMapByArtifactId(Ljava/util/Collection;)Ljava/util/Map;
> [ERROR] -----------------------------------------------------
> [ERROR] realm = plugin>org.apache.npanday.plugins:maven-compile-plugin:1.4.1-incubating-SNAPSHOT
> [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
> [ERROR] urls[0] = file:/C:/Users/sr/.m2/repository/org/apache/npanday/plugins/maven-compile-plugin/1.4.1-incubating-SNAPSHOT/maven-compile-plugin-1.4.1-incubating-SNAPSHOT.jar
> [ERROR] urls[1] = file:/C:/Users/sr/.m2/repository/org/apache/npanday/dotnet-registry/1.4.1-incubating-SNAPSHOT/dotnet-registry-1.4.1-incubating-SNAPSHOT.jar
> [ERROR] urls[2] = file:/C:/Users/sr/.m2/repository/net/sf/kxml/kxml2/2.1.8/kxml2-2.1.8.jar
> [ERROR] urls[3] = file:/C:/Users/sr/.m2/repository/xmlpull/xmlpull/1.1.3.4a/xmlpull-1.1.3.4a.jar
> [ERROR] urls[4] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-repository-api/2.0-beta5/openrdf-repository-api-2.0-beta5.jar
> [ERROR] urls[5] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-query/2.0-beta5/openrdf-query-2.0-beta5.jar
> [ERROR] urls[6] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-sail-api/2.0-beta5/openrdf-sail-api-2.0-beta5.jar
> [ERROR] urls[7] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-queryresultio-api/2.0-beta5/openrdf-queryresultio-api-2.0-beta5.jar
> [ERROR] urls[8] = file:/C:/Users/sr/.m2/repository/org/openrdf/openrdf-rio-api/2.0-beta5/openrdf-rio-api-2.0-beta5.jar
> [ERROR] urls[9] = file:/C:/Users/sr/.m2/repository/info/aduna/aduna-xml/1.2/aduna-xml-1.2.jar
> [ERROR] urls[10] = file:/C:/Users/sr/.m2/repository/info/aduna/aduna-lang/1.3/aduna-lang-1.3.jar
> It looks like the java class AssemblyResolverImpl.java. (from the dotnet-artifact project) can only use the maven 2 API.
> I tried the following workaround just to see if I could get it work with maven 3. I post it here as hack, as it's using reflection to fallback to the maven 3 api.
> {code}
> private Map<String, Artifact> artifactMapByArtifactId(java.util.Collection<Artifact> artifacts){
> try{
> for(java.lang.reflect.Method method : ArtifactUtils.class.getDeclaredMethods()){
> if (method.getName() == "artifactMapByVersionlessId"){
> return (Map<String, Artifact>)method.invoke(null, new Object[]{artifacts});
> }
> }
> } catch(java.lang.IllegalAccessException e){
> throw new RuntimeException("failed to map artifacts using ArtifactUtils class", e);
> }catch(java.lang.reflect.InvocationTargetException e){
> throw new RuntimeException("failed to map artifacts using ArtifactUtils class", e);
> }
> return ArtifactUtils.artifactMapByArtifactId( Collections.singleton( artifacts )) ;
> }
> public void resolve(Artifact artifact, List remoteRepositories, ArtifactRepository localRepository) throws ArtifactResolutionException, ArtifactNotFoundException
> {
>
> String mavenProjectRefId = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion();
> MavenProject mavenProjectRef = (MavenProject) mavenProjectRefs.get( mavenProjectRefId );
> if ( mavenProjectRef != null )
> {
> if ( "pom".equals( artifact.getType() ) )
> {
> artifact.setFile( mavenProjectRef.getFile() );
> return;
> }
> else
> {
> Map artifactMapByArtifactId = new HashMap();
> artifactMapByArtifactId.putAll( artifactMapByArtifactId( Collections.singleton( mavenProjectRef.getArtifact() ) ) );
> artifactMapByArtifactId.putAll( artifactMapByArtifactId( mavenProjectRef.getArtifacts() ) );
> artifactMapByArtifactId.putAll( artifactMapByArtifactId( mavenProjectRef.getAttachedArtifacts() ) );
> Artifact projectArtifact = (Artifact) artifactMapByArtifactId.get( artifact.getId() );
> if ( projectArtifact != null )
> {
> artifact.setFile( projectArtifact.getFile() );
> return;
> }
> }
> }
> delegate.resolve( artifact, remoteRepositories, localRepository );
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira