Skip to content

Commit

Permalink
Try using release false to get local publish to complete
Browse files Browse the repository at this point in the history
Signed-off-by: l-1squared <[email protected]>
  • Loading branch information
l-1squared committed Nov 21, 2023
1 parent 3365493 commit 81afa85
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Stream;

Expand All @@ -25,30 +26,32 @@ class BasicMavenMojoTest {

@BeforeEach
void copyResourcesToTemporaryDirectory() throws IOException {
var sourceFolder = Path.of("src/test/resources" , PROJECT_FOLDER);
var sourceFolder = Path.of("src/test/resources", PROJECT_FOLDER);
copyFolder(sourceFolder, temporaryDirectory);
}

@BeforeEach
void publishPluginVersionToMavenLocal(){
GradleRunner.create().withProjectDir(new File(System.getProperty("user.dir")))
void publishPluginVersionToMavenLocal() {
var env = new HashMap<>(System.getenv());
env.put("RELEASE", "false");
GradleRunner.create().withProjectDir(new File(System.getProperty("user.dir")))
.withEnvironment(env)
.withArguments(
"publishToMavenLocal",
"-x", "test", //don't test, or we'll loop infinitely
"-x", "signPluginMavenPublication" //may break releases.
"-x", "test" //don't test, or we'll loop infinitely
)
.build();
}

@Test
void testMavenProducesHtmlAndAsciiReport() throws MavenInvocationException {
var mavenExecutable= this.findMavenExecutable();
var mavenExecutable = this.findMavenExecutable();

InvocationRequest request = new DefaultInvocationRequest();
request.setInputStream(InputStream.nullInputStream());
request.setBatchMode(true);
request.addArg("-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn");
request.setPomFile(new File(temporaryDirectory.toFile(),"pom.xml"));
request.setPomFile(new File(temporaryDirectory.toFile(), "pom.xml"));
request.setGoals(List.of("verify"));
request.setOutputHandler(System.out::println);

Expand Down Expand Up @@ -76,7 +79,7 @@ private void copy(Path source, Path dest) {
}
}

private File findMavenExecutable(){
private File findMavenExecutable() {
return System.getenv().keySet().stream()
.filter(key -> key.equalsIgnoreCase("PATH"))
.map(key -> System.getenv().get(key))
Expand Down

0 comments on commit 81afa85

Please sign in to comment.