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
  • 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

      @Parameter(required=true, readonly=true, property="basedir") protected File baseDirectory
    • classpathElements

      @Parameter(required=true, readonly=true, property="project.compileClasspathElements") protected List<String> classpathElements
    • testClasspathElements

      @Parameter(required=true, readonly=true, property="project.testClasspathElements") protected List<String> 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

      @Parameter protected String[] sourceDirectories
      Location of the source files.
    • testSourceDirectories

      @Parameter protected String[] testSourceDirectories
      Location of the source files.
    • baseTestSourceDirectory

      @Parameter(required=true, defaultValue="${project.build.testSourceDirectory}") protected File baseTestSourceDirectory
      Location of the source files.
    • generatedSourceDirectory

      @Parameter(required=true, defaultValue="${project.build.outputDirectory}/../generated-sources") protected File generatedSourceDirectory
      Location of the generated source files.
    • workingDirectory

      @Parameter protected File workingDirectory
      Working directory for forked java clojure process.
    • compileDeclaredNamespaceOnly

      @Parameter(defaultValue="false") protected boolean compileDeclaredNamespaceOnly
      Should we compile all namespaces or only those defined?
    • namespaces

      @Parameter protected String[] namespaces
      A list of namespaces to compile
    • directLinking

      @Parameter(required=true, defaultValue="false") protected Boolean directLinking
      A list of namespaces to compile clojure.compiler.direct-linking
    • testDeclaredNamespaceOnly

      @Parameter(defaultValue="false") protected boolean testDeclaredNamespaceOnly
      Should we test all namespaces or only those defined?
    • testNamespaces

      @Parameter protected String[] testNamespaces
      A list of test namespaces to compile
    • prependClasses

      @Parameter private List<String> prependClasses
      Classes to put onto the command line before the main class
    • clojureOptions

      @Parameter(property="clojure.options") private String clojureOptions
      Clojure/Java command-line options
    • runWithTests

      @Parameter(property="clojure.runwith.test", defaultValue="true") private boolean runWithTests
      Run with test-classpath or compile-classpath?
    • includePluginDependencies

      @Parameter(defaultValue="false") private boolean includePluginDependencies
      Include plugin dependencies in classpath?
    • copiedNamespaces

      @Parameter protected String[] copiedNamespaces
      A list of namespaces whose source files will be copied to the output.
    • copyDeclaredNamespaceOnly

      @Parameter(defaultValue="false") protected boolean copyDeclaredNamespaceOnly
      Should we copy the source of all namespaces or only those defined?
    • charset

      @Parameter(defaultValue="${project.build.sourceEncoding}") protected String charset
      Source file encoding
    • copyAllCompiledNamespaces

      @Parameter(defaultValue="false") private boolean copyAllCompiledNamespaces
      Should the source files of all compiled namespaces be copied to the output? This overrides copiedNamespaces and copyDeclaredNamespaceOnly.
    • warnOnReflection

      @Parameter(defaultValue="false") private boolean warnOnReflection
      Should reflective invocations in Clojure source emit warnings? Corresponds with the *warn-on-reflection* var and the clojure.compile.warn-on-reflection system property.
    • vmargs

      @Parameter(property="clojure.vmargs") private String vmargs
      Specify additional vmargs to use when running clojure or swank.
    • spawnInteractiveConsoleOnWindows

      @Parameter(defaultValue="true") private boolean spawnInteractiveConsoleOnWindows
      Spawn a new console window for interactive clojure sessions on Windows
    • windowsConsole

      @Parameter(defaultValue="cmd /c start") private String windowsConsole
      Which Windows command to use when starting the REPL
  • Constructor Details

    • AbstractClojureCompilerMojo

      public AbstractClojureCompilerMojo()
  • Method Details

    • escapeFilePath

      protected String escapeFilePath(String directory, String file)
      Escapes the given file path so that it's safe for inclusion in a Clojure string literal.
      Parameters:
      directory - directory path
      file - file name
      Returns:
      escaped file path, ready for inclusion in a string literal
    • escapeFilePath

      protected String escapeFilePath(File file)
      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

      private String getJavaExecutable() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • getDefaultJavaHomeExecutable

      public static String getDefaultJavaHomeExecutable(Map<String,String> env)
    • getWorkingDirectory

      protected File getWorkingDirectory() throws org.apache.maven.plugin.MojoExecutionException
      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

      private File[] translatePaths(String[] paths)
    • 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

      public List<String> 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

      private String manifestClasspath(File[] sourceDirectory, File outputDirectory, List<String> compileClasspathElements)
    • getPath

      private String getPath(File[] sourceDirectory)
    • createJar

      private File createJar(String cp, String mainClass)
    • isExistingTestScriptFile

      protected boolean isExistingTestScriptFile(String path)
    • isClasspathResource

      protected boolean isClasspathResource(String path)