Class AbstractClojureCompilerMojo

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.io.File baseDirectory  
      protected java.io.File baseTestSourceDirectory
      Location of the source files.
      protected java.lang.String charset
      Source file encoding
      protected java.util.List<java.lang.String> classpathElements  
      private java.lang.String clojureOptions
      Clojure/Java command-line options
      protected boolean compileDeclaredNamespaceOnly
      Should we compile all namespaces or only those defined?
      protected java.lang.String[] copiedNamespaces
      A list of namespaces whose source files will be copied to the output.
      private boolean copyAllCompiledNamespaces
      Should the source files of all compiled namespaces be copied to the output? This overrides copiedNamespaces and copyDeclaredNamespaceOnly.
      protected boolean copyDeclaredNamespaceOnly
      Should we copy the source of all namespaces or only those defined?
      protected java.lang.Boolean directLinking
      A list of namespaces to compile clojure.compiler.direct-linking
      protected java.io.File generatedSourceDirectory
      Location of the generated source files.
      private boolean includePluginDependencies
      Include plugin dependencies in classpath?
      protected java.lang.String[] namespaces
      A list of namespaces to compile
      protected java.io.File outputDirectory  
      private java.util.List<org.apache.maven.artifact.Artifact> pluginArtifacts  
      private java.util.List<java.lang.String> prependClasses
      Classes to put onto the command line before the main class
      protected org.apache.maven.project.MavenProject project  
      private boolean runWithTests
      Run with test-classpath or compile-classpath?
      private org.apache.maven.execution.MavenSession session  
      protected java.lang.String[] sourceDirectories
      Location of the source files.
      private boolean spawnInteractiveConsoleOnWindows
      Spawn a new console window for interactive clojure sessions on Windows
      protected java.util.List<java.lang.String> testClasspathElements  
      protected boolean testDeclaredNamespaceOnly
      Should we test all namespaces or only those defined?
      protected java.lang.String[] testNamespaces
      A list of test namespaces to compile
      protected java.io.File testOutputDirectory  
      protected java.lang.String[] testSourceDirectories
      Location of the source files.
      private org.apache.maven.toolchain.ToolchainManager toolchainManager  
      private java.lang.String vmargs
      Specify additional vmargs to use when running clojure or swank.
      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.
      private java.lang.String windowsConsole
      Which Windows command to use when starting the REPL
      protected java.io.File workingDirectory
      Working directory for forked java clojure process.
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void callClojureWith​(ExecutionMode executionMode, java.io.File[] sourceDirectory, java.io.File outputDirectory, java.util.List<java.lang.String> compileClasspathElements, java.lang.String mainClass, NamespaceInFile[] namespaceArgs)  
      protected void callClojureWith​(ExecutionMode executionMode, java.io.File[] sourceDirectory, java.io.File outputDirectory, java.util.List<java.lang.String> compileClasspathElements, java.lang.String mainClass, java.lang.String[] clojureArgs)  
      protected void callClojureWith​(java.io.File[] sourceDirectory, java.io.File outputDirectory, java.util.List<java.lang.String> compileClasspathElements, java.lang.String mainClass, NamespaceInFile[] namespaceArgs)  
      protected void callClojureWith​(java.io.File[] sourceDirectory, java.io.File outputDirectory, java.util.List<java.lang.String> compileClasspathElements, java.lang.String mainClass, java.lang.String[] clojureArgs)  
      protected void copyNamespaceSourceFilesToOutput​(java.io.File outputDirectory, NamespaceInFile[] discoveredNamespaces)  
      private java.io.File createJar​(java.lang.String cp, java.lang.String mainClass)  
      protected java.io.File createTemporaryDirectory​(java.lang.String name)  
      protected NamespaceInFile[] discoverNamespaces()  
      protected NamespaceInFile[] discoverNamespacesToCopy()  
      protected java.lang.String escapeFilePath​(java.io.File file)
      Escapes the given file path so that it's safe for inclusion in a Clojure string literal.
      protected java.lang.String escapeFilePath​(java.lang.String directory, java.lang.String file)
      Escapes the given file path so that it's safe for inclusion in a Clojure string literal.
      static java.lang.String getDefaultJavaHomeExecutable​(java.util.Map<java.lang.String,​java.lang.String> env)  
      private java.lang.String getJavaExecutable()  
      private java.lang.String getPath​(java.io.File[] sourceDirectory)  
      java.util.List<java.lang.String> getRunWithClasspathElements()  
      java.io.File[] getSourceDirectories​(AbstractClojureCompilerMojo.SourceDirectory... sourceDirectoryTypes)  
      protected java.io.File getWorkingDirectory()  
      protected boolean isClasspathResource​(java.lang.String path)  
      protected boolean isExistingTestScriptFile​(java.lang.String path)  
      private java.lang.String manifestClasspath​(java.io.File[] sourceDirectory, java.io.File outputDirectory, java.util.List<java.lang.String> compileClasspathElements)  
      private java.io.File[] translatePaths​(java.lang.String[] paths)  
      • Methods inherited from class org.apache.maven.plugin.AbstractMojo

        getLog, getPluginContext, setLog, setPluginContext
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.maven.plugin.Mojo

        execute
    • Field Detail

      • 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 java.io.File baseDirectory
      • classpathElements

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

        @Parameter(required=true,
                   readonly=true,
                   property="project.testClasspathElements")
        protected java.util.List<java.lang.String> testClasspathElements
      • pluginArtifacts

        @Parameter(required=true,
                   property="plugin.artifacts")
        private java.util.List<org.apache.maven.artifact.Artifact> pluginArtifacts
      • outputDirectory

        @Parameter(required=true,
                   defaultValue="${project.build.outputDirectory}")
        protected java.io.File outputDirectory
      • testOutputDirectory

        @Parameter(required=true,
                   defaultValue="${project.build.testOutputDirectory}")
        protected java.io.File testOutputDirectory
      • sourceDirectories

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

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

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

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

        @Parameter
        protected java.io.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 java.lang.String[] namespaces
        A list of namespaces to compile
      • directLinking

        @Parameter(required=true,
                   defaultValue="false")
        protected java.lang.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 java.lang.String[] testNamespaces
        A list of test namespaces to compile
      • prependClasses

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

        @Parameter(property="clojure.options")
        private java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.String windowsConsole
        Which Windows command to use when starting the REPL
    • Constructor Detail

      • AbstractClojureCompilerMojo

        public AbstractClojureCompilerMojo()
    • Method Detail

      • escapeFilePath

        protected java.lang.String escapeFilePath​(java.lang.String directory,
                                                  java.lang.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 java.lang.String escapeFilePath​(java.io.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 java.lang.String getJavaExecutable()
                                            throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • getDefaultJavaHomeExecutable

        public static java.lang.String getDefaultJavaHomeExecutable​(java.util.Map<java.lang.String,​java.lang.String> env)
      • getWorkingDirectory

        protected java.io.File getWorkingDirectory()
                                            throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • createTemporaryDirectory

        protected java.io.File createTemporaryDirectory​(java.lang.String name)
                                                 throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • translatePaths

        private java.io.File[] translatePaths​(java.lang.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
      • getRunWithClasspathElements

        public java.util.List<java.lang.String> getRunWithClasspathElements()
      • copyNamespaceSourceFilesToOutput

        protected void copyNamespaceSourceFilesToOutput​(java.io.File outputDirectory,
                                                        NamespaceInFile[] discoveredNamespaces)
                                                 throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • callClojureWith

        protected void callClojureWith​(java.io.File[] sourceDirectory,
                                       java.io.File outputDirectory,
                                       java.util.List<java.lang.String> compileClasspathElements,
                                       java.lang.String mainClass,
                                       NamespaceInFile[] namespaceArgs)
                                throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • callClojureWith

        protected void callClojureWith​(java.io.File[] sourceDirectory,
                                       java.io.File outputDirectory,
                                       java.util.List<java.lang.String> compileClasspathElements,
                                       java.lang.String mainClass,
                                       java.lang.String[] clojureArgs)
                                throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • callClojureWith

        protected void callClojureWith​(ExecutionMode executionMode,
                                       java.io.File[] sourceDirectory,
                                       java.io.File outputDirectory,
                                       java.util.List<java.lang.String> compileClasspathElements,
                                       java.lang.String mainClass,
                                       NamespaceInFile[] namespaceArgs)
                                throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • callClojureWith

        protected void callClojureWith​(ExecutionMode executionMode,
                                       java.io.File[] sourceDirectory,
                                       java.io.File outputDirectory,
                                       java.util.List<java.lang.String> compileClasspathElements,
                                       java.lang.String mainClass,
                                       java.lang.String[] clojureArgs)
                                throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • manifestClasspath

        private java.lang.String manifestClasspath​(java.io.File[] sourceDirectory,
                                                   java.io.File outputDirectory,
                                                   java.util.List<java.lang.String> compileClasspathElements)
      • getPath

        private java.lang.String getPath​(java.io.File[] sourceDirectory)
      • createJar

        private java.io.File createJar​(java.lang.String cp,
                                       java.lang.String mainClass)
      • isExistingTestScriptFile

        protected boolean isExistingTestScriptFile​(java.lang.String path)
      • isClasspathResource

        protected boolean isClasspathResource​(java.lang.String path)