public class MavenProject extends Object implements Comparable<MavenProject>
Every pom.xml file is parsed into an instance of this class; the tree of
projects shares a BuildEnvironment
instance.
Modifier and Type | Field and Description |
---|---|
protected boolean |
buildFromSource |
protected boolean |
built |
protected MavenProject[] |
children |
protected Coordinate |
coordinate |
protected List<Coordinate> |
dependencies |
protected List<Coordinate> |
dependencyManagement |
protected File |
directory |
protected BuildEnvironment |
env |
protected boolean |
includeImplementationBuild |
protected String |
mainClass |
protected List<String> |
modules |
protected String |
packaging |
protected MavenProject |
parent |
protected Coordinate |
parentCoordinate |
protected Map<String,String> |
properties |
protected Set<String> |
repositories |
protected String |
sourceDirectory |
protected String |
sourceVersion |
protected File |
target |
protected String |
targetVersion |
Modifier | Constructor and Description |
---|---|
protected |
MavenProject(BuildEnvironment miniMaven,
File directory,
MavenProject parent) |
Modifier and Type | Method and Description |
---|---|
protected MavenProject |
addChild(MavenProject child) |
protected MavenProject |
addModule(String name) |
protected long |
addRecursively(List<String> list,
File directory,
String extension,
File targetDirectory,
String targetExtension,
boolean includeUpToDates) |
protected void |
addToJarRecursively(JarOutputStream out,
File directory,
String prefix) |
void |
append(StringBuilder builder,
String indent) |
protected boolean |
arrayContainsString(String[] array,
String key) |
void |
build()
Compiles the project.
|
void |
build(boolean makeJar)
Compiles the project and optionally builds the .jar artifact.
|
void |
build(boolean makeJar,
boolean forceBuild)
Compiles the project and optionally builds the .jar artifact.
|
void |
build(boolean makeJar,
boolean forceBuild,
boolean includeSources)
Compiles the project and optionally builds the .jar artifact.
|
void |
buildAndInstall()
Builds the artifact and installs it and its dependencies into
${imagej.app.directory}.
|
void |
buildAndInstall(File ijDir)
Builds the project an its dependencies, and installs them into the given
ImageJ.app/ directory structure.
|
void |
buildAndInstall(File ijDir,
boolean forceBuild)
Builds the project an its dependencies, and installs them into the given
ImageJ.app/ directory structure.
|
void |
buildJar()
Builds the artifact.
|
protected MavenProject |
cacheAndReturn(String key,
MavenProject pom) |
protected void |
checkParentTag(String tag,
String string1,
String string2) |
boolean |
checkUpToDate(boolean includingJar) |
void |
clean() |
void |
clean(File ijDir) |
int |
compareTo(MavenProject other) |
void |
copyDependencies(File directory,
boolean onlyNewer)
Copy the runtime dependencies
|
protected void |
download() |
protected void |
download(Coordinate dependency,
boolean quiet) |
void |
downloadDependencies() |
boolean |
equals(Object other) |
Coordinate |
expand(Coordinate dependency) |
String |
expand(String string) |
protected MavenProject |
findInMultiProjects(Coordinate dependency) |
protected String |
findLocallyCachedVersion(String path) |
MavenProject |
findPOM(Coordinate dependency,
boolean quiet,
boolean downloadAutomatically) |
String |
getArtifactId() |
boolean |
getBuildFromSource() |
MavenProject[] |
getChildren() |
String |
getClassPath(boolean forCompile) |
Coordinate |
getCoordinate() |
Set<MavenProject> |
getDependencies() |
Set<MavenProject> |
getDependencies(boolean excludeOptionals,
boolean downloadAutomatically,
String... excludeScopes) |
void |
getDependencies(Set<MavenProject> result,
boolean excludeOptionals,
boolean downloadAutomatically,
Set<String> exclusions,
String... excludeScopes) |
List<Coordinate> |
getDirectDependencies() |
File |
getDirectory() |
String |
getGAV() |
String |
getGroupId() |
String |
getJarName() |
String |
getMainClass() |
String |
getPackaging() |
MavenProject |
getParent() |
String |
getProperty(String key)
Returns the (possibly project-specific) value of a property.
|
protected Set<String> |
getRepositories() |
protected void |
getRepositories(Set<String> result) |
MavenProject |
getRoot() |
File |
getSourceDirectory() |
String |
getSourcePath() |
File |
getTarget() |
String |
getVersion() |
int |
hashCode() |
boolean |
isJAR()
True iff artifact is a JAR file (i.e.,
getPackaging() is "jar" or
"bundle"). |
protected boolean |
maybeDownloadAutomatically(Coordinate dependency,
boolean quiet,
boolean downloadAutomatically) |
String |
toString() |
protected long |
updateRecursively(File source,
File target,
boolean dryRun) |
boolean |
upToDate(boolean includingJar) |
protected final BuildEnvironment env
protected boolean buildFromSource
protected boolean built
protected File directory
protected File target
protected String sourceDirectory
protected MavenProject parent
protected MavenProject[] children
protected Coordinate coordinate
protected Coordinate parentCoordinate
protected List<Coordinate> dependencies
protected List<Coordinate> dependencyManagement
protected String sourceVersion
protected String targetVersion
protected String mainClass
protected boolean includeImplementationBuild
protected String packaging
protected MavenProject(BuildEnvironment miniMaven, File directory, MavenProject parent)
protected MavenProject addModule(String name) throws IOException, ParserConfigurationException, SAXException
protected MavenProject addChild(MavenProject child)
public void clean() throws IOException, ParserConfigurationException, SAXException
public void clean(File ijDir) throws IOException, ParserConfigurationException, SAXException
public void downloadDependencies() throws IOException, ParserConfigurationException, SAXException
protected void download() throws FileNotFoundException
FileNotFoundException
protected void download(Coordinate dependency, boolean quiet) throws FileNotFoundException
FileNotFoundException
public boolean upToDate(boolean includingJar) throws IOException, ParserConfigurationException, SAXException
public boolean checkUpToDate(boolean includingJar) throws IOException, ParserConfigurationException, SAXException
public File getSourceDirectory()
public String getSourcePath()
protected void addToJarRecursively(JarOutputStream out, File directory, String prefix) throws IOException
IOException
public void buildAndInstall() throws JavaCompiler.CompileError, IOException, ParserConfigurationException, SAXException
If the property imagej.app.directory does not point to a valid directory, the install step is skipped.
public void buildAndInstall(File ijDir) throws JavaCompiler.CompileError, IOException, ParserConfigurationException, SAXException
If the property imagej.app.directory does not point to a valid directory, the install step is skipped.
ijDir
- the ImageJ.app/ directoryJavaCompiler.CompileError
IOException
ParserConfigurationException
SAXException
public void buildAndInstall(File ijDir, boolean forceBuild) throws JavaCompiler.CompileError, IOException, ParserConfigurationException, SAXException
If the property imagej.app.directory does not point to a valid directory, the install step is skipped.
ijDir
- the ImageJ.app/ directoryforceBuild
- recompile even if the artifact is up-to-dateJavaCompiler.CompileError
IOException
ParserConfigurationException
SAXException
public void buildJar() throws JavaCompiler.CompileError, IOException, ParserConfigurationException, SAXException
public void build() throws JavaCompiler.CompileError, IOException, ParserConfigurationException, SAXException
public void build(boolean makeJar) throws JavaCompiler.CompileError, IOException, ParserConfigurationException, SAXException
makeJar
- build a .jar fileJavaCompiler.CompileError
IOException
ParserConfigurationException
SAXException
public void build(boolean makeJar, boolean forceBuild) throws JavaCompiler.CompileError, IOException, ParserConfigurationException, SAXException
makeJar
- build a .jar fileforceBuild
- for recompilation even if the artifact is up-to-dateJavaCompiler.CompileError
IOException
ParserConfigurationException
SAXException
public void build(boolean makeJar, boolean forceBuild, boolean includeSources) throws JavaCompiler.CompileError, IOException, ParserConfigurationException, SAXException
makeJar
- build a .jar fileforceBuild
- for recompilation even if the artifact is up-to-dateincludeSources
- include sources if building a .jar fileJavaCompiler.CompileError
IOException
ParserConfigurationException
SAXException
protected long addRecursively(List<String> list, File directory, String extension, File targetDirectory, String targetExtension, boolean includeUpToDates)
protected long updateRecursively(File source, File target, boolean dryRun) throws IOException
IOException
public Coordinate getCoordinate()
public String getGAV()
public String getGroupId()
public String getArtifactId()
public String getVersion()
public String getJarName()
public String getMainClass()
public String getPackaging()
public boolean isJAR()
getPackaging()
is "jar" or
"bundle").public File getTarget()
public File getDirectory()
public boolean getBuildFromSource()
public String getClassPath(boolean forCompile) throws IOException, ParserConfigurationException, SAXException
public void copyDependencies(File directory, boolean onlyNewer) throws IOException, ParserConfigurationException, SAXException
directory
- where to copy the files toonlyNewer
- whether to copy the files only if the sources are newerIOException
ParserConfigurationException
SAXException
public Set<MavenProject> getDependencies() throws IOException, ParserConfigurationException, SAXException
public Set<MavenProject> getDependencies(boolean excludeOptionals, boolean downloadAutomatically, String... excludeScopes) throws IOException, ParserConfigurationException, SAXException
public void getDependencies(Set<MavenProject> result, boolean excludeOptionals, boolean downloadAutomatically, Set<String> exclusions, String... excludeScopes) throws IOException, ParserConfigurationException, SAXException
public List<Coordinate> getDirectDependencies()
public Coordinate expand(Coordinate dependency)
public String getProperty(String key)
System properties override project-specific properties to allow the user to overrule a setting by specifying it on the command-line.
key
- the name of the propertypublic MavenProject getParent()
public MavenProject[] getChildren()
public MavenProject getRoot()
public MavenProject findPOM(Coordinate dependency, boolean quiet, boolean downloadAutomatically) throws IOException, ParserConfigurationException, SAXException
protected MavenProject findInMultiProjects(Coordinate dependency) throws IOException, ParserConfigurationException, SAXException
protected MavenProject cacheAndReturn(String key, MavenProject pom)
protected boolean maybeDownloadAutomatically(Coordinate dependency, boolean quiet, boolean downloadAutomatically)
protected String findLocallyCachedVersion(String path) throws IOException
IOException
public int compareTo(MavenProject other)
compareTo
in interface Comparable<MavenProject>
public void append(StringBuilder builder, String indent)
Copyright © 2015–2022 SciJava. All rights reserved.