Package kr.motd.maven.os
Class DetectMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- kr.motd.maven.os.DetectMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="detect", defaultPhase=VALIDATE) public class DetectMojo extends org.apache.maven.plugin.AbstractMojo
Detects the current operating system and architecture, normalizes them, and sets them to various project properties.os.detected.name
- normalizedos.name
(e.g.linux
,osx
)os.detected.arch
- normalizedos.arch
(e.g.x86_64
,x86_32
)os.detected.classifier
- a shortcut for'os.detectedName'.'os.detectedArch'
(e.g.linux-x86_64
). If the property${os.detection.classifierWithLikes}
is set, the first value for which a correspondingos.detected.release.like.{variant}
property exists will be appended to the classifier (e.g. building on ubuntu withos.detection.classifierWithLikes = "debian,rhel"
would result inos.detected.classifier = "linux-x86_64-debian"
).os.detected.release
- provides the ID for the linux release (if available).os.detected.release.version
- provides version ID for this linux release. Only available if ${os.detected.release} is also available.os.detected.release.like.{variant}
- Identifies a linux release that this release is "like" (for example, ubuntu is "like" debian). Only available if ${os.detected.release} is also available. An entry will always be made for os.detected.release.like.${os.detected.release}.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.String
CLASSIFIER_WITH_LIKES_PROPERTY
private java.lang.String
classifierWithLikes
private Detector
detector
private org.apache.maven.project.MavenProject
project
-
Constructor Summary
Constructors Constructor Description DetectMojo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute()
static java.util.List<java.lang.String>
getClassifierWithLikes(java.lang.String propertyValue)
Takes a comma-separated value of os "likes" to be included in the generated classifier and returns them as a list.
-
-
-
Field Detail
-
CLASSIFIER_WITH_LIKES_PROPERTY
static final java.lang.String CLASSIFIER_WITH_LIKES_PROPERTY
- See Also:
- Constant Field Values
-
project
@Parameter(defaultValue="${project}", readonly=true) private org.apache.maven.project.MavenProject project
-
classifierWithLikes
@Parameter(property="os.detection.classifierWithLikes", defaultValue="${os.detection.classifierWithLikes}") private java.lang.String classifierWithLikes
-
detector
private final Detector detector
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getClassifierWithLikes
public static java.util.List<java.lang.String> getClassifierWithLikes(@Nullable java.lang.String propertyValue)
Takes a comma-separated value of os "likes" to be included in the generated classifier and returns them as a list.- Parameters:
propertyValue
- the value of theCLASSIFIER_WITH_LIKES_PROPERTY
property.- Returns:
- the value as a list of entries.
-
-