public final class JkJavaProjectMaker extends java.lang.Object implements JkArtifactProducer, JkFileSystemLocalizable
By default instances of this class include two artifacts : the main artifacts consisting in the binary jar and the source jar.
One can include extra artifacts to produce or remove already defined ones. Including new artifacts suppose to provides
a Runnable responsible to actually create
All defined tasks are extensible using JkRunnables mechanism.
| Modifier and Type | Field and Description |
|---|---|
static JkArtifactId |
JAVADOC_ARTIFACT_ID |
static JkArtifactId |
SOURCES_ARTIFACT_ID |
static JkArtifactId |
TEST_ARTIFACT_ID |
static JkArtifactId |
TEST_SOURCE_ARTIFACT_ID |
| Modifier and Type | Method and Description |
|---|---|
JkJavaProjectMaker |
addArtifact(JkArtifactId artifactId,
java.lang.Runnable runnable)
Defines how to produce the specified artifact.
|
void |
addJavadocArtifact() |
void |
addTestArtifact() |
void |
addTestSourceArtifact() |
JkJavaProjectMaker |
clean()
Deletes project build outputs.
|
JkJavaProjectMaker |
defineMainArtifactAsFatJar(boolean defineOriginal)
Convenient method for defining a fat jar artifact having the specified classifier name.
|
JkPathSequence |
fetchDependenciesFor(JkScope... scopes)
Returns lib paths standing for the resolution of this project dependencies for the specified dependency scopes.
|
JkPathSequence |
fetchRuntimeDependencies(JkArtifactId artifactFileId)
Returns the runtime dependencies of the specified artifact file.
|
java.lang.Iterable<JkArtifactId> |
getArtifactIds()
Returns all the artifact ids likely to be produced by this artifact producer.
|
java.nio.file.Path |
getArtifactPath(JkArtifactId artifactId)
Returns file ofSystem path where is supposed to be produced the specified artifact file id.
|
java.nio.file.Path |
getBaseDir()
Returns the base directory of this object.
|
JkDependencyResolver |
getDependencyResolver() |
JkProjectOutLayout |
getOutLayout() |
JkRunnables |
getOutputCleaner()
Holds runnables executed while
clean() method is invoked. |
java.lang.Runnable |
getRunnable(JkArtifactId artifactId)
Returns the runnable responsible for creating the specified artifactId.
|
JkDependencySet |
getScopeDefaultedDependencies()
Returns dependencies declared for this project.
|
JkJavaProjectCompileTasks |
getTasksForCompilation() |
JkJavaProjectJavadocTasks |
getTasksForJavadoc() |
JkJavaProjectPackTasks |
getTasksForPackaging() |
JkJavaProjectPublishTasks |
getTasksForPublishing() |
JkJavaProjectTestTasks |
getTasksForTesting() |
void |
makeArtifact(JkArtifactId artifactId)
Produces the specified artifact file.
|
JkJavaProjectMaker |
removeArtifact(JkArtifactId artifactId)
Removes the definition of the specified artifacts.
|
JkJavaProjectMaker |
setDependencyResolver(JkDependencyResolver dependencyResolver) |
JkJavaProjectMaker |
setDownloadRepos(JkRepoSet repos) |
JkJavaProjectMaker |
setFailOnDependencyResolutionError(boolean fail)
If
true this object will throw a JkException whenever a dependency resolution occurs. |
JkJavaProjectMaker |
setOutLayout(JkProjectOutLayout outLayout) |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitmakeAllArtifacts, makeAllMissingArtifacts, makeArtifacts, makeArtifacts, makeMainArtifact, makeMissingArtifacts, makeMissingArtifactsgetAllArtifactPaths, getArtifactIdsWithClassifier, getMainArtifactId, getMainArtifactPathpublic static final JkArtifactId SOURCES_ARTIFACT_ID
public static final JkArtifactId JAVADOC_ARTIFACT_ID
public static final JkArtifactId TEST_ARTIFACT_ID
public static final JkArtifactId TEST_SOURCE_ARTIFACT_ID
public java.nio.file.Path getBaseDir()
JkFileSystemLocalizablegetBaseDir in interface JkFileSystemLocalizablepublic JkProjectOutLayout getOutLayout()
public JkJavaProjectMaker setOutLayout(JkProjectOutLayout outLayout)
public JkJavaProjectMaker setFailOnDependencyResolutionError(boolean fail)
true this object will throw a JkException whenever a dependency resolution occurs. Otherwise
just log a warn message. false by default.public JkJavaProjectMaker addArtifact(JkArtifactId artifactId, java.lang.Runnable runnable)
JkJavaProjectMaker declares predefined artifact ids as SOURCES_ARTIFACT_ID
or JAVADOC_ARTIFACT_ID.public JkJavaProjectMaker removeArtifact(JkArtifactId artifactId)
makeArtifact(theRemovedArtifactId)
will raise an exception.public void makeArtifact(JkArtifactId artifactId)
JkArtifactProducermakeArtifact in interface JkArtifactProducerpublic JkJavaProjectMaker defineMainArtifactAsFatJar(boolean defineOriginal)
defineOriginal - If true, a "original" artifact will be created standing for the original jar.public java.nio.file.Path getArtifactPath(JkArtifactId artifactId)
JkArtifactLocatorgetArtifactPath in interface JkArtifactLocatorpublic final java.lang.Iterable<JkArtifactId> getArtifactIds()
JkArtifactLocatorgetArtifactIds in interface JkArtifactLocatorpublic void addTestArtifact()
public void addTestSourceArtifact()
public void addJavadocArtifact()
public java.lang.Runnable getRunnable(JkArtifactId artifactId)
public JkPathSequence fetchDependenciesFor(JkScope... scopes)
public JkDependencySet getScopeDefaultedDependencies()
JkJavaDepScopes.COMPILE_AND_RUNTIMEpublic JkDependencyResolver getDependencyResolver()
public JkJavaProjectMaker setDependencyResolver(JkDependencyResolver dependencyResolver)
public JkJavaProjectMaker setDownloadRepos(JkRepoSet repos)
public JkPathSequence fetchRuntimeDependencies(JkArtifactId artifactFileId)
JkArtifactProducerfetchRuntimeDependencies in interface JkArtifactProducerpublic JkRunnables getOutputCleaner()
clean() method is invoked. Add your own runnable if you want to
improve the clean method.public JkJavaProjectMaker clean()
public JkJavaProjectJavadocTasks getTasksForJavadoc()
public JkJavaProjectCompileTasks getTasksForCompilation()
public JkJavaProjectTestTasks getTasksForTesting()
public JkJavaProjectPackTasks getTasksForPackaging()
public JkJavaProjectPublishTasks getTasksForPublishing()
public java.lang.String toString()
toString in class java.lang.Object