If the attached artifacts are not explicitly listed as dependencies, then your best bet is to use the projectBuilder to materialize the MavenProject and then get the attached artifacts.
-----Original Message----- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Filip Jirsák Sent: Friday, September 12, 2008 9:36 AM To: dev@maven.apache.org Subject: dependencies and attached artifacts Hello, I write maven plugin, which packages jar file along with some other files and create new file. This new file is attached at project as attached artifact with type "nbm-file": projectHelper.attachArtifact( project, "nbm-file", null, nbmfile ); This is ProjectA. Than I have some other project, ProjectB, which depends on ProjectA – either directly or it has ProjectB in transitive dependencies. In my plugin for ProjectB I need collect all attached artifacts of type "nbm-file" from whichever project ProjectB has in its transitive dependencies (i. e. attached artifact of ProjectA and may be attached artifacts of type "nbm-file" from other transitive dependencies). What is the right way how to do this? I have some code now, but I it looks strange to do it this way: Set artifacts = project.getArtifacts(); Iterator it = artifacts.iterator(); while ( it.hasNext() ) { Artifact art = (Artifact) it.next(); if (!"nbm-file".equals(art.getType())) { art = artifactFactory.createArtifact(art.getGroupId(), art.getArtifactId(), art.getVersion(), art.getScope(), "nbm-file"); try { resolver.resolve(art, remoteRepos, local); } catch (ArtifactResolutionException ex) { getLog().error( ex ); continue; // unknown error } catch (ArtifactNotFoundException ex) { continue; //attached artifact of type "nbm-file" not found, probably some normal "jar" dependency } } } Should I instead transform each Artifact to MavenProject and use getAttachedArtifacts() method? Or should this be solved in completely different manner? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]