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
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Fileprotected Fileprotected booleanprotected Fileprotected booleanprotected booleanSet this to true to ensure that native-image is found in your toolchain and not in an unrelated JDK or in your PATH.protected List<ExcludeConfigConfiguration>protected List<org.apache.maven.model.Exclusion>protected booleanprotected Stringprotected Stringprotected org.apache.maven.plugin.MojoExecutionprotected static final Stringprotected static final Stringprotected static final Stringprotected Fileprotected org.apache.maven.plugin.descriptor.PluginDescriptorprotected List<org.apache.maven.artifact.Artifact>protected booleanprotected Stringprotected Fileprotected org.apache.maven.execution.MavenSessionprotected booleanprotected org.apache.maven.toolchain.ToolchainManagerprotected Booleanprotected booleanFields inherited from class org.graalvm.buildtools.maven.AbstractNativeMojo
logger, mavenProject, mavenSession, metadataRepository, metadataRepositoryConfiguration, metadataRepositoryConfigurations, metadataRepositoryInitialBackoffMillis, metadataRepositoryMaxRetries, pluginManager, project, reachabilityMetadataOutputDirectory, repositorySystemFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddArtifactToClasspath(org.apache.maven.artifact.Artifact artifact) protected voidprotected voidprotected voidprotected voidprotected Stringprotected PathReturns path to where application classes are stored, or jar artifact if it is produced.protected static StringgetVersionInformation(org.codehaus.plexus.logging.Logger logger) Returns the output of calling "native-image --version".protected booleanisExcluded(org.apache.maven.artifact.Artifact dependency) protected static booleanisOracleGraalVM(org.codehaus.plexus.logging.Logger logger) protected voidmaybeAddDependencyMetadata(org.apache.maven.artifact.Artifact dependency, Consumer<File> excludeAction) protected voidprotected voidmaybeAddReachabilityMetadata(List<String> configDirs) protected voidprotected voidprotected PathprocessArtifact(org.apache.maven.artifact.Artifact artifact, String... artifactTypes) protected PathprocessSupportedArtifacts(org.apache.maven.artifact.Artifact artifact) protected voidwarnIfWrongMetaInfLayout(Path jarFilePath, org.apache.maven.artifact.Artifact artifact) Methods inherited from class org.graalvm.buildtools.maven.AbstractNativeMojo
configureMetadataRepository, downloadMetadata, getMetadataVersion, isArtifactExcludedFromMetadataRepository, isMetadataRepositoryEnabled, unzipLocalMetadataMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.maven.plugin.Mojo
execute
-
Field Details
-
NATIVE_IMAGE_META_INF
- See Also:
-
NATIVE_IMAGE_PROPERTIES_FILENAME
- See Also:
-
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
-
imageName
-
classpath
-
classesDirectory
-
defaultClassesDirectory
@Parameter(defaultValue="${project.build.outputDirectory}", readonly=true, required=true) protected File defaultClassesDirectory -
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 -
quickBuild
@Parameter(property="quickBuild", defaultValue="false") protected boolean quickBuild -
useArgFile
-
buildArgs
-
resourcesConfigDirectory
@Parameter(defaultValue="${project.build.directory}/native/generated", property="resourcesConfigDirectory", required=true) protected File resourcesConfigDirectory -
agentResourceDirectory
-
excludeConfig
-
environment
-
systemProperties
-
configFiles
-
jvmArgs
-
runtimeArgs
-
dryRun
@Parameter(property="nativeDryRun", defaultValue="false") protected boolean dryRun -
requiredVersion
-
exclusions
-
toolchainManager
@Component protected org.apache.maven.toolchain.ToolchainManager toolchainManager -
enforceToolchain
@Parameter(property="enforceToolchain") protected boolean enforceToolchainSet 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
- 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
-
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:
maybeAddDependencyMetadatain classAbstractNativeMojo
-
isExcluded
protected boolean isExcluded(org.apache.maven.artifact.Artifact dependency) -
getMainBuildPath
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
- 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
-
maybeAddReachabilityMetadata
-