diff --git a/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-feature/feature/build.properties b/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-feature/feature/build.properties new file mode 100644 index 0000000000..0b6dc2b511 --- /dev/null +++ b/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-feature/feature/build.properties @@ -0,0 +1,11 @@ +############################################################################### +# Copyright (c) 2010, 2011 SAP AG and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# https://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# SAP AG - initial API and implementation +############################################################################### +bin.includes = feature.xml diff --git a/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-feature/feature/feature.xml b/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-feature/feature/feature.xml new file mode 100644 index 0000000000..c124ac532d --- /dev/null +++ b/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-feature/feature/feature.xml @@ -0,0 +1,30 @@ + + + + + A description of an example feature + + + + [Enter Copyright Description here.] + + + + [Enter License Description here.] + + + + + + + + + + diff --git a/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-feature/feature/pom.xml b/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-feature/feature/pom.xml new file mode 100644 index 0000000000..defb37f1b3 --- /dev/null +++ b/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-feature/feature/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + + tycho-its + missing.parent + 1.0.0-SNAPSHOT + + + org.osgi.service.jaxrs.feature + eclipse-feature + Example Feature + + + + org.osgi + org.osgi.service.jaxrs + 1.0.1 + provided + + + org.apache.aries.spec + org.apache.aries.javax.jax.rs-api + 1.0.4 + provided + + + javax.xml.bind + jaxb-api + 2.3.1 + provided + + + jakarta.activation + jakarta.activation-api + 1.2.2 + provided + + + org.eclipse.platform + org.eclipse.osgi + 3.18.600 + provided + + + + diff --git a/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-feature/pom.xml b/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-feature/pom.xml new file mode 100644 index 0000000000..e6378baee9 --- /dev/null +++ b/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-feature/pom.xml @@ -0,0 +1,29 @@ + + 4.0.0 + + tycho-its + missing.parent + 1.0.0-SNAPSHOT + pom + + + UTF-8 + + + + feature + product + + + + + + org.eclipse.tycho + tycho-maven-plugin + ${tycho-version} + true + + + + diff --git a/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-feature/product/feature.product b/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-feature/product/feature.product new file mode 100644 index 0000000000..238246b4e9 --- /dev/null +++ b/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-feature/product/feature.product @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-feature/product/pom.xml b/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-feature/product/pom.xml new file mode 100644 index 0000000000..d29c849d38 --- /dev/null +++ b/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-feature/product/pom.xml @@ -0,0 +1,49 @@ + + + + + 4.0.0 + + tycho-its + missing.parent + 1.0.0-SNAPSHOT + + feature.product + eclipse-repository + + + + + org.eclipse.tycho + tycho-maven-plugin + ${tycho-version} + true + + + org.eclipse.tycho + tycho-p2-director-plugin + ${tycho-version} + + + materialize-products + + materialize-products + + + + + + + + + + org.osgi + org.osgi.service.jaxrs + 1.0.1 + + + + \ No newline at end of file diff --git a/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-plugins/plugin.product b/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-plugins/plugin.product new file mode 100644 index 0000000000..b0c1ef4d9b --- /dev/null +++ b/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-plugins/plugin.product @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-plugins/pom.xml b/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-plugins/pom.xml new file mode 100644 index 0000000000..9c35ce9b0e --- /dev/null +++ b/tycho-its/projects/tycho-p2-director-plugin/missing-requirements-plugins/pom.xml @@ -0,0 +1,49 @@ + + + + 4.0.0 + tycho-its + plugin.product + 1.0.0-SNAPSHOT + eclipse-repository + + + UTF-8 + + + + + + org.eclipse.tycho + tycho-maven-plugin + ${tycho-version} + true + + + org.eclipse.tycho + tycho-p2-director-plugin + ${tycho-version} + + + materialize-products + + materialize-products + + + + + + + + + + org.osgi + org.osgi.service.jaxrs + 1.0.1 + + + + \ No newline at end of file diff --git a/tycho-its/src/test/java/org/eclipse/tycho/test/product/ProductBuildTest.java b/tycho-its/src/test/java/org/eclipse/tycho/test/product/ProductBuildTest.java index aad80f804c..1709f7a0d4 100644 --- a/tycho-its/src/test/java/org/eclipse/tycho/test/product/ProductBuildTest.java +++ b/tycho-its/src/test/java/org/eclipse/tycho/test/product/ProductBuildTest.java @@ -13,6 +13,7 @@ import static org.hamcrest.Matchers.hasItem; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.io.File; import java.io.IOException; @@ -24,6 +25,7 @@ import java.util.Optional; import java.util.stream.Collectors; +import org.apache.maven.it.VerificationException; import org.apache.maven.it.Verifier; import org.eclipse.tycho.TargetEnvironment; import org.eclipse.tycho.TychoConstants; @@ -39,6 +41,22 @@ public class ProductBuildTest extends AbstractTychoIntegrationTest { private static final List REQUIRED_PGP_PROPERTIES = List.of(TychoConstants.PROP_PGP_SIGNATURES, TychoConstants.PROP_PGP_KEYS); + @Test + public void testPluginProjectFailsOnMissingDependencies() throws Exception { + Verifier verifier = getVerifier("tycho-p2-director-plugin/missing-requirements-plugins", false, true); + assertThrows(VerificationException.class, () -> verifier.executeGoals(Arrays.asList("clean", "package"))); + verifier.verifyTextInLog( + "Cannot resolve dependencies of project tycho-its:plugin.product:eclipse-repository:1.0.0-SNAPSHOT"); + } + + @Test + public void testFeatureProjectFailsOnMissingDependencies() throws Exception { + Verifier verifier = getVerifier("tycho-p2-director-plugin/missing-requirements-feature", false, true); + assertThrows(VerificationException.class, () -> verifier.executeGoals(Arrays.asList("clean", "package"))); + verifier.verifyTextInLog( + "Cannot resolve dependencies of project tycho-its:feature.product:eclipse-repository:1.0.0-SNAPSHOT"); + } + @Test public void testMavenDepedencyInTarget() throws Exception { Verifier verifier = getVerifier("product.mavenLocation", false);