Package org.graalvm.buildtools.maven
Class AbstractNativeMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.graalvm.buildtools.maven.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 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 org.codehaus.plexus.logging.Logger
logger
protected java.lang.String
mainClass
protected org.graalvm.reachability.GraalVMReachabilityMetadataRepository
metadataRepository
protected MetadataRepositoryConfiguration
metadataRepositoryConfiguration
protected java.util.Set<java.nio.file.Path>
metadataRepositoryPaths
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 org.apache.maven.project.MavenProject
project
protected boolean
quickBuild
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
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractNativeMojo()
-
Method Summary
All 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
configureMetadataRepository()
protected java.util.Optional<java.nio.file.Path>
downloadMetadata(java.net.URL url, java.nio.file.Path destination)
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 java.util.Optional<java.lang.String>
getMetadataVersion(org.apache.maven.artifact.Artifact dependency)
boolean
isArtifactExcludedFromMetadataRepository(org.apache.maven.artifact.Artifact dependency)
protected boolean
isMetadataRepositoryEnabled()
protected void
maybeAddDependencyMetadata(org.apache.maven.artifact.Artifact dependency)
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 artifactType)
protected java.nio.file.Path
unzipLocalMetadata(java.nio.file.Path localPath, java.nio.file.Path destination)
protected void
warnIfWrongMetaInfLayout(java.nio.file.Path jarFilePath, org.apache.maven.artifact.Artifact artifact)
-
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
-
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
-
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
-
metadataRepositoryConfiguration
@Parameter(alias="metadataRepository") protected MetadataRepositoryConfiguration metadataRepositoryConfiguration
-
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
-
-
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)
-
-