org.codehaus.cargo.maven2
Class DependencyCalculator

java.lang.Object
  extended by org.codehaus.cargo.maven2.DependencyCalculator

public class DependencyCalculator
extends Object

This class is effectively an unmitigated hack. Any offers to do it 'properly' are gratefully received from someone who can get the guts of Maven to do what want. Basically, given our 'uberwar' project, instead of simply merging WEB-INF/lib files, we wish to treat those war files as ordinary dependencies, and to calculate the 'effective' list of jar files that SHOULD be in WEB-INF/lib that way. I.E, if we are including A.WAR and B.WAR, both of which use different versions of X.JAR, then we should calculate what the 'right' version of the X.JAR that we ought to be using. This seems very hard to do given the tools provided by maven. There are alternate solutions, such as WAR files producing their code in a JAR as well, but this relies on including BOTH the WAR and the JAR, which is not pretty. This class does it a hacky way. For each of the war files in the dependency tree (including the caller), it generates an alternate pom file, which 'pretends' that the WAR file is a POM, and replaces any dependent WARS with equivalent dependencies of type POM with a different classifier. It then invokes maven to resolve that project, which appears to resolve the versions (as would have been done in an all-jar universe). A better way would probably be to be able to customise the dependency calculation system, but this seems very bound up in all the project/artifact gubbins.


Constructor Summary
DependencyCalculator(org.apache.maven.artifact.factory.ArtifactFactory artifactFactory, org.apache.maven.artifact.resolver.ArtifactResolver resolver, org.apache.maven.artifact.repository.ArtifactRepository localRepository, List remoteRepositories, org.apache.maven.project.MavenProject mavenProject, org.apache.maven.project.MavenProjectBuilder mavenProjectBuilder, org.apache.maven.artifact.installer.ArtifactInstaller installer, org.codehaus.plexus.PlexusContainer container)
           
 
Method Summary
 Set execute()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DependencyCalculator

public DependencyCalculator(org.apache.maven.artifact.factory.ArtifactFactory artifactFactory,
                            org.apache.maven.artifact.resolver.ArtifactResolver resolver,
                            org.apache.maven.artifact.repository.ArtifactRepository localRepository,
                            List remoteRepositories,
                            org.apache.maven.project.MavenProject mavenProject,
                            org.apache.maven.project.MavenProjectBuilder mavenProjectBuilder,
                            org.apache.maven.artifact.installer.ArtifactInstaller installer,
                            org.codehaus.plexus.PlexusContainer container)
Method Detail

execute

public Set execute()
            throws org.apache.maven.artifact.resolver.ArtifactResolutionException,
                   org.apache.maven.artifact.resolver.ArtifactNotFoundException,
                   org.apache.maven.project.ProjectBuildingException,
                   FileNotFoundException,
                   IOException,
                   org.codehaus.plexus.util.xml.pull.XmlPullParserException,
                   org.apache.maven.project.artifact.InvalidDependencyVersionException,
                   org.apache.maven.artifact.installer.ArtifactInstallationException
Throws:
org.apache.maven.artifact.resolver.ArtifactResolutionException
org.apache.maven.artifact.resolver.ArtifactNotFoundException
org.apache.maven.project.ProjectBuildingException
FileNotFoundException
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
org.apache.maven.project.artifact.InvalidDependencyVersionException
org.apache.maven.artifact.installer.ArtifactInstallationException


Copyright © 2004-2012 Codehaus. All Rights Reserved.