Package org.eclipse.tycho.plugins.p2
Class P2MetadataMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.eclipse.tycho.plugins.p2.P2MetadataMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
P2MetadataDefaultMojo
@Mojo(name="p2-metadata", threadSafe=true) public class P2MetadataMojo extends org.apache.maven.plugin.AbstractMojo
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
attachP2Metadata
private BaselineMode
baselineMode
What happens when build artifact does not match baseline version:disable
: Disable baseline validation.warn
(default): Warn about discrepancies between build and baseline artifacts but do not fail the build.failCommon
: Fail the build if there are discrepancies between artifacts present both in build and baseline.private BaselineReplace
baselineReplace
Whether to replace build artifacts with baseline version or use reactor version:none
: Do not replace build artifacts with baseline version.common
: Replace build artifacts with baseline version.private java.util.List<Repository>
baselineRepositories
Baseline build repository(ies).private BaselineValidator
baselineValidator
private EquinoxServiceFactory
equinox
protected org.apache.maven.plugin.MojoExecution
execution
private boolean
generateDownloadStatsProperty
Whether to generate a 'download.stats' property for artifact metadata.private static java.lang.Object
LOCK
protected org.apache.maven.project.MavenProject
project
protected org.apache.maven.project.MavenProjectHelper
projectHelper
private java.util.List<java.lang.String>
supportedProjectTypes
Project types which this plugin supports.
-
Constructor Summary
Constructors Constructor Description P2MetadataMojo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
attachP2Metadata()
void
execute()
private static java.util.Map<java.lang.String,java.io.File>
getAllProjectArtifacts(org.apache.maven.project.MavenProject project)
Returns a map from classifiers to artifact files of the given project.private static java.lang.String
getExtension(java.io.File file)
private <T> T
getService(java.lang.Class<T> type)
private static boolean
hasAttachedArtifact(org.apache.maven.project.MavenProject project, java.lang.String classifier)
(package private) static void
writeArtifactLocations(java.io.File outputFile, java.util.Map<java.lang.String,java.io.File> artifactLocations)
private static void
writeProperties(java.util.Properties properties, java.io.File outputFile)
-
-
-
Field Detail
-
LOCK
private static final java.lang.Object LOCK
-
project
@Parameter(property="project") protected org.apache.maven.project.MavenProject project
-
execution
@Parameter(property="mojoExecution", readonly=true) protected org.apache.maven.plugin.MojoExecution execution
-
attachP2Metadata
@Parameter(defaultValue="true") protected boolean attachP2Metadata
-
projectHelper
@Component protected org.apache.maven.project.MavenProjectHelper projectHelper
-
equinox
@Component private EquinoxServiceFactory equinox
-
supportedProjectTypes
@Parameter private java.util.List<java.lang.String> supportedProjectTypes
Project types which this plugin supports.
-
baselineRepositories
@Parameter private java.util.List<Repository> baselineRepositories
Baseline build repository(ies). P2 assumes that the same artifact type, id and version represent the same artifact. If baselineRepositories parameter is specified, this assumption is validated and optionally enforced.
-
baselineMode
@Parameter(property="tycho.baseline", defaultValue="warn") private BaselineMode baselineMode
What happens when build artifact does not match baseline version:disable
: Disable baseline validation.warn
(default): Warn about discrepancies between build and baseline artifacts but do not fail the build.failCommon
: Fail the build if there are discrepancies between artifacts present both in build and baseline. Attached artifacts only present in the build do not result in build failure.fail
: Fail the build if there are any discrepancy between build and baseline artifacts.
-
baselineReplace
@Parameter(property="tycho.baseline.replace", defaultValue="all") private BaselineReplace baselineReplace
Whether to replace build artifacts with baseline version or use reactor version:none
: Do not replace build artifacts with baseline version.common
: Replace build artifacts with baseline version. Attached artifacts only present in the build are not removed and will likely result in inconsistencies among artifacts of the same project! Use as last resort when baseline does not contain all build artifacts.all
(default): Replace build artifacts with baseline version. Attached artifacts only present in the build are removed.
-
generateDownloadStatsProperty
@Parameter(property="tycho.generateDownloadStatsProperty", defaultValue="false") private boolean generateDownloadStatsProperty
Whether to generate a 'download.stats' property for artifact metadata. See https://wiki.eclipse.org/Equinox_p2_download_stats
-
baselineValidator
@Component private BaselineValidator baselineValidator
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
getService
private <T> T getService(java.lang.Class<T> type)
-
attachP2Metadata
protected void attachP2Metadata() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
hasAttachedArtifact
private static boolean hasAttachedArtifact(org.apache.maven.project.MavenProject project, java.lang.String classifier)
-
getExtension
private static java.lang.String getExtension(java.io.File file)
-
getAllProjectArtifacts
private static java.util.Map<java.lang.String,java.io.File> getAllProjectArtifacts(org.apache.maven.project.MavenProject project)
Returns a map from classifiers to artifact files of the given project. The classifiernull
is mapped to the project's main artifact.
-
writeArtifactLocations
static void writeArtifactLocations(java.io.File outputFile, java.util.Map<java.lang.String,java.io.File> artifactLocations) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
writeProperties
private static void writeProperties(java.util.Properties properties, java.io.File outputFile) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
-