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 ModuleDefinitions 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, toStringpublic 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.
IOExceptionprotected void loadModuleDefs(Map<ModuleId,ModuleDefinition> moduleDefs, List<URI> libraries) throws IOException
AbstractRepositoryImplAbstractRepositoryImpl.initialize() to load all ModuleDefinitions and libraries defintionsloadModuleDefs in class AbstractRepositoryImplIOExceptionprotected com.sun.enterprise.module.maven.MavenModuleDefinition loadJar(File jar) throws IOException
AbstractRepositoryImplModuleDefinition.
The system allows ModuleDefinitions 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 Repositorys), so it makes sense
to try to stick to the "common" loading scheme.
loadJar in class AbstractRepositoryImpljar - Either a jar file or a directory that has the same structure as a jar file.IOExceptionCopyright © 2009–2017 Oracle Corporation. All rights reserved.