Class AbstractNativeMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
    Direct Known Subclasses:
    NativeBuildMojo, NativeTestMojo

    public abstract class AbstractNativeMojo
    extends org.apache.maven.plugin.AbstractMojo
    • Field Detail

      • NATIVE_IMAGE_META_INF

        protected static final java.lang.String NATIVE_IMAGE_META_INF
        See Also:
        Constant Field Values
      • NATIVE_IMAGE_PROPERTIES_FILENAME

        protected static final java.lang.String NATIVE_IMAGE_PROPERTIES_FILENAME
        See Also:
        Constant Field Values
      • NATIVE_IMAGE_DRY_RUN

        protected static final java.lang.String NATIVE_IMAGE_DRY_RUN
        See Also:
        Constant Field Values
      • plugin

        @Parameter(defaultValue="${plugin}",
                   readonly=true)
        protected org.apache.maven.plugin.descriptor.PluginDescriptor plugin
      • session

        @Parameter(defaultValue="${session}",
                   readonly=true)
        protected org.apache.maven.execution.MavenSession session
      • project

        @Parameter(defaultValue="${project}",
                   readonly=true,
                   required=true)
        protected org.apache.maven.project.MavenProject project
      • mojoExecution

        @Parameter(defaultValue="${mojoExecution}")
        protected org.apache.maven.plugin.MojoExecution mojoExecution
      • pluginArtifacts

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

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

        @Parameter(property="mainClass")
        protected java.lang.String mainClass
      • imageName

        @Parameter(property="imageName",
                   defaultValue="${project.artifactId}")
        protected java.lang.String imageName
      • classpath

        @Parameter(property="classpath")
        protected java.util.List<java.lang.String> classpath
      • classesDirectory

        @Parameter(property="classesDirectory")
        protected java.io.File classesDirectory
      • defaultClassesDirectory

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

        protected final java.util.List<java.nio.file.Path> imageClasspath
      • metadataRepositoryPaths

        protected final java.util.Set<java.nio.file.Path> metadataRepositoryPaths
      • debug

        @Parameter(property="debug",
                   defaultValue="false")
        protected boolean debug
      • fallback

        @Parameter(property="fallback",
                   defaultValue="false")
        protected boolean fallback
      • verbose

        @Parameter(property="verbose",
                   defaultValue="false")
        protected boolean verbose
      • sharedLibrary

        @Parameter(property="sharedLibrary",
                   defaultValue="false")
        protected boolean sharedLibrary
      • quickBuild

        @Parameter(property="quickBuild",
                   defaultValue="false")
        protected boolean quickBuild
      • useArgFile

        @Parameter(property="useArgFile")
        protected java.lang.Boolean useArgFile
      • buildArgs

        @Parameter(property="buildArgs")
        protected java.util.List<java.lang.String> buildArgs
      • resourcesConfigDirectory

        @Parameter(defaultValue="${project.build.directory}/native/generated",
                   property="resourcesConfigDirectory",
                   required=true)
        protected java.io.File resourcesConfigDirectory
      • agentResourceDirectory

        @Parameter(property="agentResourceDirectory")
        protected java.io.File agentResourceDirectory
      • environment

        @Parameter(property="environmentVariables")
        protected java.util.Map<java.lang.String,​java.lang.String> environment
      • systemProperties

        @Parameter(property="systemPropertyVariables")
        protected java.util.Map<java.lang.String,​java.lang.String> systemProperties
      • configFiles

        @Parameter(property="configurationFileDirectories")
        protected java.util.List<java.lang.String> configFiles
      • jvmArgs

        @Parameter(property="jvmArgs")
        protected java.util.List<java.lang.String> jvmArgs
      • dryRun

        @Parameter(property="nativeDryRun",
                   defaultValue="false")
        protected boolean dryRun
      • metadataRepository

        protected org.graalvm.reachability.GraalVMReachabilityMetadataRepository metadataRepository
      • logger

        @Component
        protected org.codehaus.plexus.logging.Logger logger
      • toolchainManager

        @Component
        protected org.apache.maven.toolchain.ToolchainManager toolchainManager
    • Constructor Detail

      • AbstractNativeMojo

        @Inject
        protected AbstractNativeMojo()
    • Method Detail

      • getBuildArgs

        protected java.util.List<java.lang.String> getBuildArgs()
                                                         throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • processArtifact

        protected java.nio.file.Path processArtifact​(org.apache.maven.artifact.Artifact artifact,
                                                     java.lang.String artifactType)
                                              throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • addArtifactToClasspath

        protected void addArtifactToClasspath​(org.apache.maven.artifact.Artifact artifact)
                                       throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • warnIfWrongMetaInfLayout

        protected void warnIfWrongMetaInfLayout​(java.nio.file.Path jarFilePath,
                                                org.apache.maven.artifact.Artifact artifact)
                                         throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • getDependencyScopes

        protected abstract java.util.List<java.lang.String> getDependencyScopes()
      • addDependenciesToClasspath

        protected void addDependenciesToClasspath()
                                           throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • getMainBuildPath

        protected java.nio.file.Path getMainBuildPath()
                                               throws org.apache.maven.plugin.MojoExecutionException
        Returns path to where application classes are stored, or jar artifact if it is produced.
        Returns:
        Path to application classes
        Throws:
        org.apache.maven.plugin.MojoExecutionException - failed getting main build path
      • populateApplicationClasspath

        protected void populateApplicationClasspath()
                                             throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • populateClasspath

        protected void populateClasspath()
                                  throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • getClasspath

        protected java.lang.String getClasspath()
                                         throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • buildImage

        protected void buildImage()
                           throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • maybeAddGeneratedResourcesConfig

        protected void maybeAddGeneratedResourcesConfig​(java.util.List<java.lang.String> into)
      • isMetadataRepositoryEnabled

        protected boolean isMetadataRepositoryEnabled()
      • configureMetadataRepository

        protected void configureMetadataRepository()
      • isArtifactExcludedFromMetadataRepository

        public boolean isArtifactExcludedFromMetadataRepository​(org.apache.maven.artifact.Artifact dependency)
      • maybeAddReachabilityMetadata

        protected void maybeAddReachabilityMetadata​(java.util.List<java.lang.String> configDirs)
      • maybeAddDependencyMetadata

        protected void maybeAddDependencyMetadata​(org.apache.maven.artifact.Artifact dependency)
      • getMetadataVersion

        protected java.util.Optional<java.lang.String> getMetadataVersion​(org.apache.maven.artifact.Artifact dependency)
      • downloadMetadata

        protected java.util.Optional<java.nio.file.Path> downloadMetadata​(java.net.URL url,
                                                                          java.nio.file.Path destination)
      • unzipLocalMetadata

        protected java.nio.file.Path unzipLocalMetadata​(java.nio.file.Path localPath,
                                                        java.nio.file.Path destination)