Package org.graalvm.buildtools.maven
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 Summary
Fields Modifier and Type Field Description protected java.io.File
agentResourceDirectory
protected java.util.List<java.lang.String>
buildArgs
protected java.io.File
classesDirectory
protected java.util.List<java.lang.String>
classpath
protected java.util.List<java.lang.String>
configFiles
protected boolean
debug
protected java.io.File
defaultClassesDirectory
protected boolean
dryRun
protected java.util.Map<java.lang.String,java.lang.String>
environment
protected java.util.List<ExcludeConfigConfiguration>
excludeConfig
protected boolean
fallback
protected java.util.List<java.nio.file.Path>
imageClasspath
protected java.lang.String
imageName
protected java.util.List<java.lang.String>
jvmArgs
protected java.lang.String
mainClass
protected org.apache.maven.plugin.MojoExecution
mojoExecution
protected static java.lang.String
NATIVE_IMAGE_DRY_RUN
protected static java.lang.String
NATIVE_IMAGE_META_INF
protected static java.lang.String
NATIVE_IMAGE_PROPERTIES_FILENAME
protected java.io.File
outputDirectory
protected org.apache.maven.plugin.descriptor.PluginDescriptor
plugin
protected java.util.List<org.apache.maven.artifact.Artifact>
pluginArtifacts
protected boolean
quickBuild
protected java.lang.String
requiredVersion
protected java.io.File
resourcesConfigDirectory
protected org.apache.maven.execution.MavenSession
session
protected boolean
sharedLibrary
protected java.util.Map<java.lang.String,java.lang.String>
systemProperties
protected org.apache.maven.toolchain.ToolchainManager
toolchainManager
protected java.lang.Boolean
useArgFile
protected boolean
verbose
-
Fields inherited from class org.graalvm.buildtools.maven.AbstractNativeMojo
logger, mavenProject, mavenSession, metadataRepository, metadataRepositoryConfiguration, metadataRepositoryConfigurations, metadataRepositoryInitialBackoffMillis, metadataRepositoryMaxRetries, pluginManager, project, reachabilityMetadataOutputDirectory, repositorySystem
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractNativeImageMojo()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addArtifactToClasspath(org.apache.maven.artifact.Artifact artifact)
protected void
addDependenciesToClasspath()
protected void
buildImage()
protected void
checkRequiredVersionIfNeeded()
protected java.util.List<java.lang.String>
getBuildArgs()
protected java.lang.String
getClasspath()
protected abstract java.util.List<java.lang.String>
getDependencyScopes()
protected java.nio.file.Path
getMainBuildPath()
Returns path to where application classes are stored, or jar artifact if it is produced.protected static java.lang.String
getVersionInformation(org.codehaus.plexus.logging.Logger logger)
Returns the output of calling "native-image --version".protected static boolean
isOracleGraalVM(org.codehaus.plexus.logging.Logger logger)
protected void
maybeAddGeneratedResourcesConfig(java.util.List<java.lang.String> into)
protected void
maybeAddReachabilityMetadata(java.util.List<java.lang.String> configDirs)
protected void
populateApplicationClasspath()
protected void
populateClasspath()
protected java.nio.file.Path
processArtifact(org.apache.maven.artifact.Artifact artifact, java.lang.String... artifactTypes)
protected java.nio.file.Path
processSupportedArtifacts(org.apache.maven.artifact.Artifact artifact)
protected void
warnIfWrongMetaInfLayout(java.nio.file.Path jarFilePath, org.apache.maven.artifact.Artifact artifact)
-
Methods inherited from class org.graalvm.buildtools.maven.AbstractNativeMojo
configureMetadataRepository, downloadMetadata, getMetadataVersion, isArtifactExcludedFromMetadataRepository, isMetadataRepositoryEnabled, maybeAddDependencyMetadata, unzipLocalMetadata
-
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
-
-
-
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
-
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
-
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
-
excludeConfig
@Parameter(property="excludeConfig") protected java.util.List<ExcludeConfigConfiguration> excludeConfig
-
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
-
requiredVersion
@Parameter(property="requiredVersion") protected java.lang.String requiredVersion
-
toolchainManager
@Component protected org.apache.maven.toolchain.ToolchainManager toolchainManager
-
-
Method Detail
-
getBuildArgs
protected java.util.List<java.lang.String> getBuildArgs() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
processSupportedArtifacts
protected java.nio.file.Path processSupportedArtifacts(org.apache.maven.artifact.Artifact artifact) 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... 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(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
-
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 java.lang.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(java.util.List<java.lang.String> into)
-
maybeAddReachabilityMetadata
protected void maybeAddReachabilityMetadata(java.util.List<java.lang.String> configDirs)
-
-