Hi folks,

can someone shed some light onto the release:prepare mechanism?

We use since long ago an own plugin, that accesses a secondary artifact of a 
dependency. This worked like charm ... until now. We have now the new 
situation, that the secondary artifact is build in the same multi project build 
by one subproject and it is used in another one. However, release:prepare fails 
now, since the subproject that makes usage of the secondary artifact always 
tries to access the final-but-not-yet-release version.

The Mojo does runs through the list of direct dependencies and searches for the 
configured artifact (groupId and artifactId have been configured, only one 
definition possible), creates the Artifact instance for the secondary one and 
resolves it (using the same version as the one of the direct artifact):

public void execute() throws MojoExecutionException, MojoFailureException
{
        Artifact descriptors = null;
        final Set dependencies = project.getArtifacts();
        if (dependencies != null && !dependencies.isEmpty()) {
                for (final Iterator iter = dependencies.iterator(); 
iter.hasNext();) {
                        final Artifact artifact = (Artifact) iter.next();
                        if (artifact.getGroupId().equals(groupId) && 
artifact.getArtifactId().equals(artifactId)) {
                                descriptors = artifact;
                                break;
                        }
                }
        }
        if (descriptors == null) {
                throw new MojoFailureException("There is no dependency of with 
'" + groupId + ':' + artifactId + "'");
        }
        descriptors = factory.createArtifactWithClassifier(groupId, artifactId, 
descriptors.getVersion(), "ejb-descriptors", "descriptors");
        try {
                resolver.resolve(descriptors, remoteRepos, local);
        } catch (ArtifactResolutionException e) {
                throw new MojoExecutionException("Unable to resolve artifact.", 
e);
        } catch (ArtifactNotFoundException e) {
                throw new MojoExecutionException("Unable to find artifact.", e);
        }
        ...
}


So, why is the "normal" dependency mechanism able to access the artifacts with 
the final release numbers in the target directory during release proparation 
and the code snippet from above fails to find them? How "injects" the release 
plugin those not yet installed artifacts? What do I have to do different?

Any help/insight highly welcome.

- Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to