-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38688 from vemilyus/respecting-maven-exclusions-i…
…n-gradle Making sure deployment modules excluded in POM files aren't pulled in by the Gradle plugin
- Loading branch information
Showing
17 changed files
with
475 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...tion-tests/gradle/src/main/resources/maven-exclusion-in-extension-dependency/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
plugins { | ||
id 'java' | ||
id 'io.quarkus' | ||
} | ||
|
||
repositories { | ||
mavenLocal { | ||
content { | ||
includeGroupByRegex 'io.quarkus.*' | ||
includeGroup 'org.hibernate.orm' | ||
} | ||
} | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}") | ||
implementation 'io.quarkus:quarkus-resteasy-reactive-jackson' | ||
implementation 'io.quarkus:quarkus-hibernate-reactive-panache' | ||
implementation 'io.quarkus:quarkus-reactive-pg-client' | ||
implementation 'io.quarkus:quarkus-arc' | ||
implementation 'io.quarkus:quarkus-resteasy-reactive' | ||
testImplementation 'io.quarkus:quarkus-junit5' | ||
testImplementation 'io.rest-assured:rest-assured' | ||
} | ||
|
||
group 'org.acme' | ||
version '1.0.0-SNAPSHOT' | ||
|
||
test { | ||
systemProperty "java.util.logging.manager", "org.jboss.logmanager.LogManager" | ||
} |
2 changes: 2 additions & 0 deletions
2
...tests/gradle/src/main/resources/maven-exclusion-in-extension-dependency/gradle.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
quarkusPlatformArtifactId=quarkus-bom | ||
quarkusPlatformGroupId=io.quarkus |
17 changes: 17 additions & 0 deletions
17
...n-tests/gradle/src/main/resources/maven-exclusion-in-extension-dependency/settings.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
pluginManagement { | ||
repositories { | ||
mavenLocal { | ||
content { | ||
includeGroupByRegex 'io.quarkus.*' | ||
includeGroup 'org.hibernate.orm' | ||
} | ||
} | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
plugins { | ||
id 'io.quarkus' version "${quarkusPluginVersion}" | ||
} | ||
} | ||
|
||
rootProject.name='code-with-quarkus' |
16 changes: 16 additions & 0 deletions
16
...rces/maven-exclusion-in-extension-dependency/src/main/java/org/acme/GreetingResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.acme; | ||
|
||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.Produces; | ||
import jakarta.ws.rs.core.MediaType; | ||
|
||
@Path("/hello") | ||
public class GreetingResource { | ||
|
||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String hello() { | ||
return "Hello from RESTEasy Reactive"; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...in/resources/maven-exclusion-in-extension-dependency/src/main/java/org/acme/MyEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
package org.acme; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.Id; | ||
import java.util.UUID; | ||
|
||
@Entity | ||
public class MyEntity { | ||
@Id | ||
@GeneratedValue | ||
private UUID id; | ||
} |
285 changes: 285 additions & 0 deletions
285
.../maven-exclusion-in-extension-dependency/src/main/resources/META-INF/resources/index.html
Large diffs are not rendered by default.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
...sources/maven-exclusion-in-extension-dependency/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
quarkus.datasource.db-kind = postgresql | ||
quarkus.datasource.username = quarkus_test | ||
quarkus.datasource.password = quarkus_test | ||
quarkus.datasource.reactive.url = vertx-reactive:postgresql://localhost:5432/quarkus_test | ||
#quarkus.datasource.jdbc=false |
8 changes: 8 additions & 0 deletions
8
...n-exclusion-in-extension-dependency/src/native-test/java/org/acme/GreetingResourceIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.acme; | ||
|
||
import io.quarkus.test.junit.QuarkusIntegrationTest; | ||
|
||
@QuarkusIntegrationTest | ||
class GreetingResourceIT extends GreetingResourceTest { | ||
// Execute the same tests but in packaged mode. | ||
} |
21 changes: 21 additions & 0 deletions
21
.../maven-exclusion-in-extension-dependency/src/test/java/org/acme/GreetingResourceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.acme; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.hamcrest.CoreMatchers.is; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.test.junit.QuarkusTest; | ||
|
||
@QuarkusTest | ||
class GreetingResourceTest { | ||
@Test | ||
void testHelloEndpoint() { | ||
given() | ||
.when().get("/hello") | ||
.then() | ||
.statusCode(200) | ||
.body(is("Hello from RESTEasy Reactive")); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...c/test/java/io/quarkus/gradle/devmode/MavenExclusionInExtensionDependencyDevModeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.quarkus.gradle.devmode; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* This makes sure that exclusions in POM files of deployment modules are respected. | ||
* <p> | ||
* One case where this is critical is when using quarkus-hibernate-reactive. Its deployment | ||
* module takes care of pulling in quarkus-hibernate-orm-deployment where it excludes | ||
* Agroal and Narayana. | ||
* <p> | ||
* If that exclusion isn't taken into account by the Gradle plugin, it pulls in | ||
* quarkus-hibernate-orm-deployment on its own, where those other modules aren't excluded, | ||
* which leads to a failure at runtime because Agroal tries to initialize and looks | ||
* for a JDBC driver which isn't typically available in reactive DB scenarios. | ||
*/ | ||
public class MavenExclusionInExtensionDependencyDevModeTest extends QuarkusDevGradleTestBase { | ||
@Override | ||
protected String projectDirectoryName() { | ||
return "maven-exclusion-in-extension-dependency"; | ||
} | ||
|
||
@Override | ||
protected void testDevMode() throws Exception { | ||
assertThat(getHttpResponse("/hello")).contains("Hello"); | ||
} | ||
} |