From 3200c9639ef2c487fb65ae9f7257e7a3f6ed3aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Mon, 27 Nov 2023 12:12:51 +0100 Subject: [PATCH 1/2] Update the default plugin versions sued in tycho lifecycle --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index e7780b0219..c9f7a66f1e 100644 --- a/pom.xml +++ b/pom.xml @@ -72,10 +72,10 @@ 3.35.0 7.0.0 - 2.4.3 - 2.3.1 - 2.5 - 2.4.1 + 3.3.1 + 3.1.1 + 3.1.1 + 3.3.2 ${surefire-version} From 79bcce89aa09f200fa2b1c97585fc5890934835c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Tue, 28 Nov 2023 10:16:46 +0100 Subject: [PATCH 2/2] Use main artifact p2-maven-repository packaging and default execution If the MavenP2SiteMojo is used as part of the p2-maven-repository packaging and we are in the default executions do not attach an artifact but set the main one. --- .../plugins/p2/repository/MavenP2SiteMojo.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/MavenP2SiteMojo.java b/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/MavenP2SiteMojo.java index 3e0ad0063d..76d1978c43 100644 --- a/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/MavenP2SiteMojo.java +++ b/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/MavenP2SiteMojo.java @@ -34,12 +34,14 @@ import org.apache.commons.io.FileUtils; import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.handler.DefaultArtifactHandler; import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; import org.apache.maven.artifact.resolver.ArtifactResolutionResult; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Dependency; import org.apache.maven.model.Plugin; import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecution; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Component; @@ -66,6 +68,7 @@ import org.eclipse.equinox.app.IApplication; import org.eclipse.equinox.p2.core.IProvisioningAgent; import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; +import org.eclipse.tycho.PackagingType; import org.eclipse.tycho.TychoConstants; import org.eclipse.tycho.core.PGPService; import org.eclipse.tycho.p2maven.tools.TychoFeaturesAndBundlesPublisherApplication; @@ -215,6 +218,9 @@ public class MavenP2SiteMojo extends AbstractMojo { @Parameter(defaultValue = INCLUDE_PGP_DEFAULT + "") private boolean includePGPSignature = INCLUDE_PGP_DEFAULT; + @Parameter(property = "mojoExecution", readonly = true) + MojoExecution execution; + @Override public void execute() throws MojoExecutionException, MojoFailureException { //fetch a random service to make sure OSGi framework is there ... even if the service is (yet) not used @@ -399,7 +405,14 @@ public void execute() throws MojoExecutionException, MojoFailureException { } catch (IOException e) { throw new MojoExecutionException("failed to create archive", e); } - projectHelper.attachArtifact(project, "zip", "p2site", destFile); + if (PackagingType.TYPE_P2_SITE.equals(project.getPackaging()) + && execution.getExecutionId().startsWith("default-")) { + Artifact artifact = project.getArtifact(); + artifact.setFile(destFile); + artifact.setArtifactHandler(new DefaultArtifactHandler("zip")); + } else { + projectHelper.attachArtifact(project, "zip", "p2site", destFile); + } } private List getKeyServers() {