public class MavenProjectRepository extends AbstractRepositoryImpl
Repository
implementation that loads modules
from the transitive dependencies set in a MavenProject
.listeners
Constructor and Description |
---|
MavenProjectRepository(org.apache.maven.project.MavenProject project,
org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver,
org.apache.maven.artifact.repository.ArtifactRepository localRepository,
org.apache.maven.artifact.factory.ArtifactFactory artifactFactory) |
Modifier and Type | Method and Description |
---|---|
protected com.sun.enterprise.module.maven.MavenModuleDefinition |
loadJar(File jar)
Loads a jar file and builds a
ModuleDefinition . |
protected void |
loadModuleDefs(Map<ModuleId,ModuleDefinition> moduleDefs,
List<URI> libraries)
Called from
AbstractRepositoryImpl.initialize() to load all ModuleDefinition s and libraries defintions |
static void |
prepareProject(org.apache.maven.project.MavenProject project)
When creating
MavenProjectRepository from the current project (which is used
to launch mvn), and if the compile phase has run yet, then the main artifact is
still null. |
add, addLibrary, addListener, find, findAll, findAll, getJarLocations, getLocation, getName, initialize, newModuleDefinition, remove, removeLibrary, removeListener, shutdown, toString
public MavenProjectRepository(org.apache.maven.project.MavenProject project, org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver, org.apache.maven.artifact.repository.ArtifactRepository localRepository, org.apache.maven.artifact.factory.ArtifactFactory artifactFactory)
public static void prepareProject(org.apache.maven.project.MavenProject project) throws IOException
MavenProjectRepository
from the current project (which is used
to launch mvn), and if the compile phase has run yet, then the main artifact is
still null.
However, it's often convenient to pick up the files that were left in the file system
from the previous execution. This method checks this situation and updates MavenProject
accordingly, so that it can be then passed to the constructor of MavenProjectRepository
.
Think of this as a pre-processing phase to compensate for the lack of the compile phase invocation.
IOException
protected void loadModuleDefs(Map<ModuleId,ModuleDefinition> moduleDefs, List<URI> libraries) throws IOException
AbstractRepositoryImpl
AbstractRepositoryImpl.initialize()
to load all ModuleDefinition
s and libraries defintionsloadModuleDefs
in class AbstractRepositoryImpl
IOException
protected com.sun.enterprise.module.maven.MavenModuleDefinition loadJar(File jar) throws IOException
AbstractRepositoryImpl
ModuleDefinition
.
The system allows ModuleDefinition
s to be built in any way,
but in practice module jars need to be built in a way agnostic
to Repository
implementations (so that same module could
be used in different Repository
s), so it makes sense
to try to stick to the "common" loading scheme.
loadJar
in class AbstractRepositoryImpl
jar
- Either a jar file or a directory that has the same structure as a jar file.IOException
Copyright © 2013 Oracle Corporation. All rights reserved.