Package com.theoryinpractise.clojure
Class AbstractClojureCompilerMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
com.theoryinpractise.clojure.AbstractClojureCompilerMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
ClojureAddSourceMojo,ClojureAddTestSourceMojo,ClojureAutodocMojo,ClojureCompilerMojo,ClojureGenDocMojo,ClojureMarginaliaMojo,ClojureNailgunMojo,ClojureNReplMojo,ClojureReplMojo,ClojureRunMojo,ClojureRunTestWithJUnitMojo,ClojureSwankMojo,TestClojureCompilerMojo
public abstract class AbstractClojureCompilerMojo
extends org.apache.maven.plugin.AbstractMojo
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Fileprotected FileLocation of the source files.protected StringSource file encodingprivate StringClojure/Java command-line optionsprotected booleanShould we compile all namespaces or only those defined?protected String[]A list of namespaces whose source files will be copied to the output.private booleanShould the source files of all compiled namespaces be copied to the output? This overrides copiedNamespaces and copyDeclaredNamespaceOnly.protected booleanShould we copy the source of all namespaces or only those defined?protected BooleanA list of namespaces to compile clojure.compiler.direct-linkingprotected FileLocation of the generated source files.private booleanInclude plugin dependencies in classpath?protected String[]A list of namespaces to compileprotected Fileprivate List<org.apache.maven.artifact.Artifact>Classes to put onto the command line before the main classprotected org.apache.maven.project.MavenProjectprivate booleanRun with test-classpath or compile-classpath?private org.apache.maven.execution.MavenSessionprotected String[]Location of the source files.private booleanSpawn a new console window for interactive clojure sessions on Windowsprotected booleanShould we test all namespaces or only those defined?protected String[]A list of test namespaces to compileprotected Fileprotected String[]Location of the source files.private org.apache.maven.toolchain.ToolchainManagerprivate StringSpecify additional vmargs to use when running clojure or swank.private booleanShould reflective invocations in Clojure source emit warnings? Corresponds with the *warn-on-reflection* var and the clojure.compile.warn-on-reflection system property.private StringWhich Windows command to use when starting the REPLprotected FileWorking directory for forked java clojure process.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcallClojureWith(ExecutionMode executionMode, File[] sourceDirectory, File outputDirectory, List<String> compileClasspathElements, String mainClass, NamespaceInFile[] namespaceArgs) protected voidcallClojureWith(ExecutionMode executionMode, File[] sourceDirectory, File outputDirectory, List<String> compileClasspathElements, String mainClass, String[] clojureArgs) protected voidcallClojureWith(File[] sourceDirectory, File outputDirectory, List<String> compileClasspathElements, String mainClass, NamespaceInFile[] namespaceArgs) protected voidcallClojureWith(File[] sourceDirectory, File outputDirectory, List<String> compileClasspathElements, String mainClass, String[] clojureArgs) protected voidcopyNamespaceSourceFilesToOutput(File outputDirectory, NamespaceInFile[] discoveredNamespaces) private Fileprotected Fileprotected NamespaceInFile[]protected NamespaceInFile[]protected StringescapeFilePath(File file) Escapes the given file path so that it's safe for inclusion in a Clojure string literal.protected StringescapeFilePath(String directory, String file) Escapes the given file path so that it's safe for inclusion in a Clojure string literal.static Stringprivate Stringprivate StringFile[]getSourceDirectories(AbstractClojureCompilerMojo.SourceDirectory... sourceDirectoryTypes) protected Fileprotected booleanisClasspathResource(String path) protected booleanprivate StringmanifestClasspath(File[] sourceDirectory, File outputDirectory, List<String> compileClasspathElements) private File[]translatePaths(String[] paths) Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.maven.plugin.Mojo
execute
-
Field Details
-
project
@Parameter(required=true, readonly=true, property="project") protected org.apache.maven.project.MavenProject project -
toolchainManager
@Component private org.apache.maven.toolchain.ToolchainManager toolchainManager -
session
@Parameter(required=true, readonly=true, property="session") private org.apache.maven.execution.MavenSession session -
baseDirectory
-
classpathElements
-
testClasspathElements
-
pluginArtifacts
@Parameter(required=true, property="plugin.artifacts") private List<org.apache.maven.artifact.Artifact> pluginArtifacts -
outputDirectory
@Parameter(required=true, defaultValue="${project.build.outputDirectory}") protected File outputDirectory -
testOutputDirectory
@Parameter(required=true, defaultValue="${project.build.testOutputDirectory}") protected File testOutputDirectory -
sourceDirectories
Location of the source files. -
testSourceDirectories
Location of the source files. -
baseTestSourceDirectory
@Parameter(required=true, defaultValue="${project.build.testSourceDirectory}") protected File baseTestSourceDirectoryLocation of the source files. -
generatedSourceDirectory
@Parameter(required=true, defaultValue="${project.build.outputDirectory}/../generated-sources") protected File generatedSourceDirectoryLocation of the generated source files. -
workingDirectory
Working directory for forked java clojure process. -
compileDeclaredNamespaceOnly
@Parameter(defaultValue="false") protected boolean compileDeclaredNamespaceOnlyShould we compile all namespaces or only those defined? -
namespaces
A list of namespaces to compile -
directLinking
A list of namespaces to compile clojure.compiler.direct-linking -
testDeclaredNamespaceOnly
@Parameter(defaultValue="false") protected boolean testDeclaredNamespaceOnlyShould we test all namespaces or only those defined? -
testNamespaces
A list of test namespaces to compile -
prependClasses
Classes to put onto the command line before the main class -
clojureOptions
Clojure/Java command-line options -
runWithTests
@Parameter(property="clojure.runwith.test", defaultValue="true") private boolean runWithTestsRun with test-classpath or compile-classpath? -
includePluginDependencies
@Parameter(defaultValue="false") private boolean includePluginDependenciesInclude plugin dependencies in classpath? -
copiedNamespaces
A list of namespaces whose source files will be copied to the output. -
copyDeclaredNamespaceOnly
@Parameter(defaultValue="false") protected boolean copyDeclaredNamespaceOnlyShould we copy the source of all namespaces or only those defined? -
charset
Source file encoding -
copyAllCompiledNamespaces
@Parameter(defaultValue="false") private boolean copyAllCompiledNamespacesShould the source files of all compiled namespaces be copied to the output? This overrides copiedNamespaces and copyDeclaredNamespaceOnly. -
warnOnReflection
@Parameter(defaultValue="false") private boolean warnOnReflectionShould reflective invocations in Clojure source emit warnings? Corresponds with the *warn-on-reflection* var and the clojure.compile.warn-on-reflection system property. -
vmargs
Specify additional vmargs to use when running clojure or swank. -
spawnInteractiveConsoleOnWindows
@Parameter(defaultValue="true") private boolean spawnInteractiveConsoleOnWindowsSpawn a new console window for interactive clojure sessions on Windows -
windowsConsole
Which Windows command to use when starting the REPL
-
-
Constructor Details
-
AbstractClojureCompilerMojo
public AbstractClojureCompilerMojo()
-
-
Method Details
-
escapeFilePath
Escapes the given file path so that it's safe for inclusion in a Clojure string literal.- Parameters:
directory- directory pathfile- file name- Returns:
- escaped file path, ready for inclusion in a string literal
-
escapeFilePath
Escapes the given file path so that it's safe for inclusion in a Clojure string literal.- Parameters:
file- The file whose path we want to escape- Returns:
- escaped file path, ready for inclusion in a string literal
-
getJavaExecutable
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getDefaultJavaHomeExecutable
-
getWorkingDirectory
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
createTemporaryDirectory
protected File createTemporaryDirectory(String name) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
translatePaths
-
discoverNamespaces
protected NamespaceInFile[] discoverNamespaces() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
discoverNamespacesToCopy
protected NamespaceInFile[] discoverNamespacesToCopy() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getSourceDirectories
public File[] getSourceDirectories(AbstractClojureCompilerMojo.SourceDirectory... sourceDirectoryTypes) -
getRunWithClasspathElements
-
copyNamespaceSourceFilesToOutput
protected void copyNamespaceSourceFilesToOutput(File outputDirectory, NamespaceInFile[] discoveredNamespaces) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
callClojureWith
protected void callClojureWith(File[] sourceDirectory, File outputDirectory, List<String> compileClasspathElements, String mainClass, NamespaceInFile[] namespaceArgs) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
callClojureWith
protected void callClojureWith(File[] sourceDirectory, File outputDirectory, List<String> compileClasspathElements, String mainClass, String[] clojureArgs) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
callClojureWith
protected void callClojureWith(ExecutionMode executionMode, File[] sourceDirectory, File outputDirectory, List<String> compileClasspathElements, String mainClass, NamespaceInFile[] namespaceArgs) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
callClojureWith
protected void callClojureWith(ExecutionMode executionMode, File[] sourceDirectory, File outputDirectory, List<String> compileClasspathElements, String mainClass, String[] clojureArgs) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
manifestClasspath
-
getPath
-
createJar
-
isExistingTestScriptFile
-
isClasspathResource
-