Skip to content

Commit

Permalink
Merge pull request #1452 from TNG/fix/issue-802/fix-failure-due-to-si…
Browse files Browse the repository at this point in the history
…gn-publication

Fix/issue 802/fix failure due to sign publication
  • Loading branch information
l-1squared authored Nov 21, 2023
2 parents 7a7c169 + a3a623b commit 3365493
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 73 deletions.
11 changes: 6 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ subprojects {
}
withXml {
project.configurations.compileOnly.allDependencies.each { dep ->
asNode().dependencies[0].appendNode('dependency').with {
it.appendNode('groupId', dep.group)
it.appendNode('artifactId', dep.name)
asNode().dependencies[0].appendNode('dependency').with { dependencyNode ->
dependencyNode.appendNode('groupId', dep.group)
dependencyNode.appendNode('artifactId', dep.name)
if (dep.version != null && dep.version.trim() != "") {
it.appendNode('version', dep.version)
dependencyNode.appendNode('version', dep.version)
}
it.appendNode('scope', 'provided')
dependencyNode.appendNode('scope', 'provided')
}
}

Expand Down Expand Up @@ -292,6 +292,7 @@ configure(subprojects) {
// -- build and publish artifacts -------------------------------------------------------------------------------------

signing {

// requires gradle.properties, see http://www.gradle.org/docs/current/userguide/signing_plugin.html
required {
isReleaseVersion && gradle.taskGraph.getAllTasks().any { it instanceof PublishToMavenRepository }
Expand Down
2 changes: 1 addition & 1 deletion jgiven-maven-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ generateMavenPlugin.configure {
.collect(Collectors.toList())
)
onlyIf {
println("taskGraph: " + gradle.taskGraph.getAllTasks().stream().map(Task::getName).collect(Collectors.toList()))
logger.debug("taskGraph: " + gradle.taskGraph.getAllTasks().stream().map(Task::getName).collect(Collectors.toList()))
gradle.taskGraph.getAllTasks().stream().anyMatch(thisProjectsPublishTasks::contains)
}
}
Expand Down
123 changes: 62 additions & 61 deletions jgiven-maven-plugin/src/main/maven/pom.xml
Original file line number Diff line number Diff line change
@@ -1,66 +1,67 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>jgiven-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<name>JGiven Maven Mojo</name>
<groupId>com.tngtech.jgiven</groupId>
<version>${version}</version>
<description>JGiven - BDD in plain Java</description>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>jgiven-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<name>JGiven Maven Mojo</name>
<groupId>com.tngtech.jgiven</groupId>
<version>${version}</version>
<description>JGiven - BDD in plain Java</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.10.2</version>
<executions>
<execution>
<id>default-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
<phase>process-classes</phase>
</execution>
<execution>
<id>help-descriptor</id>
<goals>
<goal>helpmojo</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
</plugins>
<sourceDirectory>../../src/main/java</sourceDirectory>
<outputDirectory>../../build/maven/target/classes</outputDirectory>
</build>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.10.2</version>
<executions>
<execution>
<id>default-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
<phase>process-classes</phase>
</execution>
<execution>
<id>help-descriptor</id>
<goals>
<goal>helpmojo</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
</plugins>
<sourceDirectory>../../src/main/java</sourceDirectory>
<outputDirectory>../../build/maven/target/classes</outputDirectory>
</build>

<dependencies>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.10.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.9.5</version>
</dependency>
<dependency>
<groupId>com.tngtech.jgiven</groupId>
<artifactId>jgiven-html5-report</artifactId>
<version>${version}</version>
</dependency>
<dependency>
<groupId>com.tngtech.jgiven</groupId>
<artifactId>jgiven-core</artifactId>
<version>${version}</version>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.10.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.9.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.tngtech.jgiven</groupId>
<artifactId>jgiven-html5-report</artifactId>
<version>${version}</version>
</dependency>
<dependency>
<groupId>com.tngtech.jgiven</groupId>
<artifactId>jgiven-core</artifactId>
<version>${version}</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ void copyResourcesToTemporaryDirectory() throws IOException {
}

@BeforeEach
void publishPluginVersionToMavenLocal()throws IOException {
GradleRunner.create().withProjectDir(new File(System.getProperty("user.dir")))
.withArguments("publishToMavenLocal", "-x", "test") //don't test, or we'll loop infinitely
void publishPluginVersionToMavenLocal(){
GradleRunner.create().withProjectDir(new File(System.getProperty("user.dir")))
.withArguments(
"publishToMavenLocal",
"-x", "test", //don't test, or we'll loop infinitely
"-x", "signPluginMavenPublication" //may break releases.
)
.build();
}

Expand All @@ -52,7 +56,7 @@ void testMavenProducesHtmlAndAsciiReport() throws MavenInvocationException {
invoker.setMavenExecutable(mavenExecutable);
InvocationResult result = invoker.execute(request);

assertThat(result.getExitCode()).isZero();
assertThat(result.getExitCode()).as("Maven exit code").isZero();
assertThat(new File(temporaryDirectory.toFile(), "target/jgiven-reports/html/index.html")).exists();
assertThat(new File(temporaryDirectory.toFile(), "target/jgiven-reports/asciidoc/index.asciidoc")).exists();
assertThat(new File(temporaryDirectory.toFile(), "target/jgiven-reports/text")).exists();
Expand Down
4 changes: 2 additions & 2 deletions jgiven-spock2/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
plugins {
id 'java-library'
id 'groovy'
}

apply plugin: 'groovy'

description = "Module for writing JGiven tests with Spock 2"

ext {
Expand All @@ -20,6 +19,7 @@ dependencies {
implementation libs.byteBuddy

testImplementation project(':jgiven-html5-report')

}

test {
Expand Down

0 comments on commit 3365493

Please sign in to comment.