Class AbstractNativeImageMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.graalvm.buildtools.maven.AbstractNativeMojo
org.graalvm.buildtools.maven.AbstractNativeImageMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
NativeCompileNoForkMojo, NativeTestMojo

public abstract class AbstractNativeImageMojo extends AbstractNativeMojo
  • Field Details

    • NATIVE_IMAGE_META_INF

      protected static final String NATIVE_IMAGE_META_INF
      See Also:
    • NATIVE_IMAGE_PROPERTIES_FILENAME

      protected static final String NATIVE_IMAGE_PROPERTIES_FILENAME
      See Also:
    • NATIVE_IMAGE_DRY_RUN

      protected static final String NATIVE_IMAGE_DRY_RUN
      See Also:
    • 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
    • mojoExecution

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

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

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

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

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

      @Parameter(property="classpath") protected List<String> classpath
    • classesDirectory

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

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

      protected final List<Path> imageClasspath
    • 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 Boolean useArgFile
    • buildArgs

      @Parameter(property="buildArgs") protected List<String> buildArgs
    • resourcesConfigDirectory

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

      @Parameter(property="agentResourceDirectory") protected File agentResourceDirectory
    • excludeConfig

      @Parameter(property="excludeConfig") protected List<ExcludeConfigConfiguration> excludeConfig
    • environment

      @Parameter(property="environmentVariables") protected Map<String,String> environment
    • systemProperties

      @Parameter(property="systemPropertyVariables") protected Map<String,String> systemProperties
    • configFiles

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

      @Parameter(property="jvmArgs") protected List<String> jvmArgs
    • runtimeArgs

      @Parameter(property="runtimeArgs") protected List<String> runtimeArgs
    • dryRun

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

      @Parameter(property="requiredVersion") protected String requiredVersion
    • exclusions

      @Parameter(property="exclusions") protected List<org.apache.maven.model.Exclusion> exclusions
    • toolchainManager

      @Component protected org.apache.maven.toolchain.ToolchainManager toolchainManager
    • enforceToolchain

      @Parameter(property="enforceToolchain") protected boolean enforceToolchain
      Set this to true to ensure that native-image is found in your toolchain and not in an unrelated JDK or in your PATH. Will fail the build in case no toolchain was found or if it does not contain native-image.
  • Constructor Details

    • AbstractNativeImageMojo

      @Inject protected AbstractNativeImageMojo()
  • Method Details

    • getBuildArgs

      protected List<String> getBuildArgs() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • processSupportedArtifacts

      protected Path processSupportedArtifacts(org.apache.maven.artifact.Artifact artifact) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • processArtifact

      protected Path processArtifact(org.apache.maven.artifact.Artifact artifact, String... artifactTypes) 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(Path jarFilePath, org.apache.maven.artifact.Artifact artifact) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • getDependencyScopes

      protected abstract List<String> getDependencyScopes()
    • addDependenciesToClasspath

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

      protected void addInferredDependenciesToClasspath()
    • maybeAddDependencyMetadata

      protected void maybeAddDependencyMetadata(org.apache.maven.artifact.Artifact dependency, Consumer<File> excludeAction)
      Overrides:
      maybeAddDependencyMetadata in class AbstractNativeMojo
    • isExcluded

      protected boolean isExcluded(org.apache.maven.artifact.Artifact dependency)
    • getMainBuildPath

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

      protected void checkRequiredVersionIfNeeded() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • isOracleGraalVM

      protected static boolean isOracleGraalVM(org.codehaus.plexus.logging.Logger logger) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • getVersionInformation

      protected static String getVersionInformation(org.codehaus.plexus.logging.Logger logger) throws org.apache.maven.plugin.MojoExecutionException
      Returns the output of calling "native-image --version".
      Parameters:
      logger - a logger, that may be null, to print warnings or useful information.
      Returns:
      the output as a string joined by "\n".
      Throws:
      org.apache.maven.plugin.MojoExecutionException - when any errors occurred.
    • maybeAddGeneratedResourcesConfig

      protected void maybeAddGeneratedResourcesConfig(List<String> into)
    • maybeAddReachabilityMetadata

      protected void maybeAddReachabilityMetadata(List<String> configDirs)