diff --git a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/Java11HttpTransportFactory.java b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/Java11HttpTransportFactory.java index 2d4cfafebd..22d33f8576 100644 --- a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/Java11HttpTransportFactory.java +++ b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/Java11HttpTransportFactory.java @@ -23,6 +23,7 @@ import java.net.http.HttpClient.Redirect; import java.net.http.HttpClient.Version; import java.net.http.HttpRequest; +import java.net.http.HttpRequest.BodyPublishers; import java.net.http.HttpRequest.Builder; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; @@ -156,7 +157,8 @@ private HttpResponse performGet() throws IOException, InterruptedEx public Response head() throws IOException { try { HttpResponse response = client.send( - builder.method("HEAD", null).timeout(Duration.ofSeconds(TIMEOUT_SECONDS)).build(), + builder.method("HEAD", BodyPublishers.noBody()).timeout(Duration.ofSeconds(TIMEOUT_SECONDS)) + .build(), BodyHandlers.discarding()); return new ResponseImplementation<>(response) { @Override diff --git a/tycho-its/projects/tycho-p2-director-plugin/director-goal-standalone/pom.xml b/tycho-its/projects/tycho-p2-director-plugin/director-goal-standalone/pom.xml new file mode 100644 index 0000000000..9577921acf --- /dev/null +++ b/tycho-its/projects/tycho-p2-director-plugin/director-goal-standalone/pom.xml @@ -0,0 +1,34 @@ + + 4.0.0 + foo + bar + 0.1.0-SNAPSHOT + pom + + + + + org.eclipse.tycho + tycho-p2-director-plugin + ${tycho-version} + + + run-director + + director + + package + + ${target-platform} + org.eclipse.osgi + target/dummy + + + + + + + + \ No newline at end of file diff --git a/tycho-its/src/test/java/org/eclipse/tycho/test/P2DirectorPluginTest.java b/tycho-its/src/test/java/org/eclipse/tycho/test/P2DirectorPluginTest.java new file mode 100644 index 0000000000..9844723f5c --- /dev/null +++ b/tycho-its/src/test/java/org/eclipse/tycho/test/P2DirectorPluginTest.java @@ -0,0 +1,15 @@ +package org.eclipse.tycho.test; + +import org.apache.maven.it.Verifier; +import org.junit.Test; + +public class P2DirectorPluginTest extends AbstractTychoIntegrationTest { + + @Test + public void testDirectorStandalone() throws Exception { + Verifier verifier = getVerifier("tycho-p2-director-plugin/director-goal-standalone", true, true); + verifier.executeGoal("package"); + verifier.verifyErrorFreeLog(); + } + +} diff --git a/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/DirectorMojo.java b/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/DirectorMojo.java index 341bfaf547..c37d3c3c10 100644 --- a/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/DirectorMojo.java +++ b/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/DirectorMojo.java @@ -38,6 +38,7 @@ import org.eclipse.equinox.p2.core.IProvisioningAgent; import org.eclipse.equinox.p2.core.IProvisioningAgentProvider; import org.eclipse.equinox.p2.core.ProvisionException; +import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager; import org.eclipse.tycho.TargetEnvironment; import org.eclipse.tycho.TychoConstants; import org.eclipse.tycho.core.shared.StatusTool; @@ -396,6 +397,8 @@ public void execute() throws MojoExecutionException, MojoFailureException { args.addNonNull("-trustedPGPKeys", trustedPGPKeys); args.addNonNull("-trustedCertificates", trustedCertificates); try { + //FIXME forcefully init OSGi unless we have a fix for https://github.com/eclipse-equinox/p2/pull/439 + agent.getService(IMetadataRepositoryManager.class); MavenDirectorLog directorLog = new MavenDirectorLog(execution.getExecutionId(), getLog()); Object exitCode = new DirectorApplication(directorLog, PhaseSetFactory.createDefaultPhaseSetExcluding(new String[] { PhaseSetFactory.PHASE_CHECK_TRUST }),