-
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.
Do not filter gradle composite project in dependency resolution
- Loading branch information
Showing
14 changed files
with
253 additions
and
3 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
31 changes: 31 additions & 0 deletions
31
...sts/gradle/src/main/resources/composite-project-with-dependencies/gradle-dao/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,31 @@ | ||
plugins { | ||
id 'java' | ||
id 'io.quarkus' | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
mavenLocal() | ||
} | ||
|
||
dependencies { | ||
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}") | ||
implementation 'io.quarkus:quarkus-hibernate-orm' | ||
implementation 'io.quarkus:quarkus-jdbc-h2' | ||
implementation 'io.quarkus:quarkus-arc' | ||
implementation 'io.quarkus:quarkus-resteasy' | ||
testImplementation 'io.quarkus:quarkus-junit5' | ||
testImplementation 'io.rest-assured:rest-assured' | ||
} | ||
|
||
group 'org.acme.gradle.multi' | ||
version '1.0.0-SNAPSHOT' | ||
|
||
compileJava { | ||
options.encoding = 'UTF-8' | ||
options.compilerArgs << '-parameters' | ||
} | ||
|
||
compileTestJava { | ||
options.encoding = 'UTF-8' | ||
} |
18 changes: 18 additions & 0 deletions
18
.../gradle/src/main/resources/composite-project-with-dependencies/gradle-dao/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,18 @@ | ||
pluginManagement { | ||
repositories { | ||
mavenCentral() | ||
// in case a custom local repo is configured we are going to use that instead of the default mavenLocal() | ||
if (System.properties.containsKey('maven.repo.local')) { | ||
maven { | ||
url System.properties.get('maven.repo.local') | ||
} | ||
} else { | ||
mavenLocal() | ||
} | ||
gradlePluginPortal() | ||
} | ||
plugins { | ||
id 'io.quarkus' version "${quarkusPluginVersion}" | ||
} | ||
} | ||
rootProject.name='gradle-dao' |
35 changes: 35 additions & 0 deletions
35
...project-with-dependencies/gradle-dao/src/main/java/org/acme/gradle/multi/dao/Product.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,35 @@ | ||
package org.acme.gradle.multi.dao; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.Id; | ||
import javax.persistence.NamedQuery; | ||
|
||
@Entity | ||
@NamedQuery(name = "Product.findAll", query = "SELECT p FROM Product p ORDER BY p.name") | ||
public class Product { | ||
@Id | ||
private Integer id; | ||
|
||
@Column | ||
private String name; | ||
|
||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
|
||
|
||
} |
18 changes: 18 additions & 0 deletions
18
...-with-dependencies/gradle-dao/src/main/java/org/acme/gradle/multi/dao/ProductService.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,18 @@ | ||
package org.acme.gradle.multi.dao; | ||
|
||
import java.util.List; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
import javax.inject.Inject; | ||
import javax.persistence.EntityManager; | ||
|
||
@ApplicationScoped | ||
public class ProductService { | ||
|
||
@Inject | ||
EntityManager em; | ||
|
||
public List<Product> getProducts() { | ||
return em.createNamedQuery("Product.findAll", Product.class).getResultList(); | ||
} | ||
} |
Empty file.
5 changes: 5 additions & 0 deletions
5
.../composite-project-with-dependencies/gradle-dao/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 = h2 | ||
quarkus.datasource.username = hibernate | ||
quarkus.datasource.password = hibernate | ||
quarkus.datasource.jdbc.url = jdbc:h2:mem:myDB | ||
quarkus.hibernate-orm.database.generation=drop-and-create |
38 changes: 38 additions & 0 deletions
38
...ts/gradle/src/main/resources/composite-project-with-dependencies/gradle-rest/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,38 @@ | ||
plugins { | ||
id 'java' | ||
id 'io.quarkus' | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
// in case a custom local repo is configured we are going to use that instead of the default mavenLocal() | ||
if (System.properties.containsKey('maven.repo.local')) { | ||
maven { | ||
url System.properties.get('maven.repo.local') | ||
} | ||
} else { | ||
mavenLocal() | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}") | ||
implementation 'io.quarkus:quarkus-resteasy' | ||
implementation 'io.quarkus:quarkus-resteasy-jackson' | ||
implementation 'io.quarkus:quarkus-arc' | ||
implementation 'org.acme.gradle.multi:gradle-dao:1.0.0-SNAPSHOT' | ||
testImplementation 'io.quarkus:quarkus-junit5' | ||
testImplementation 'io.rest-assured:rest-assured' | ||
} | ||
|
||
group 'org.acme.gradle.multi' | ||
version '1.0.0-SNAPSHOT' | ||
|
||
compileJava { | ||
options.encoding = 'UTF-8' | ||
options.compilerArgs << '-parameters' | ||
} | ||
|
||
compileTestJava { | ||
options.encoding = 'UTF-8' | ||
} |
20 changes: 20 additions & 0 deletions
20
...gradle/src/main/resources/composite-project-with-dependencies/gradle-rest/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,20 @@ | ||
pluginManagement { | ||
repositories { | ||
mavenCentral() | ||
// in case a custom local repo is configured we are going to use that instead of the default mavenLocal() | ||
if (System.properties.containsKey('maven.repo.local')) { | ||
maven { | ||
url System.properties.get('maven.repo.local') | ||
} | ||
} else { | ||
mavenLocal() | ||
} | ||
gradlePluginPortal() | ||
} | ||
plugins { | ||
id 'io.quarkus' version "${quarkusPluginVersion}" | ||
} | ||
} | ||
rootProject.name='gradle-rest' | ||
|
||
includeBuild '../gradle-dao' |
25 changes: 25 additions & 0 deletions
25
...th-dependencies/gradle-rest/src/main/java/org/acme/gradle/multi/rest/ProductResource.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,25 @@ | ||
package org.acme.gradle.multi.rest; | ||
|
||
import java.util.List; | ||
|
||
import javax.inject.Inject; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
import org.acme.gradle.multi.dao.Product; | ||
import org.acme.gradle.multi.dao.ProductService; | ||
|
||
@Path("/product") | ||
public class ProductResource { | ||
|
||
@Inject | ||
ProductService productService; | ||
|
||
@GET | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public List<Product> list() { | ||
return productService.getProducts(); | ||
} | ||
} |
Empty file.
2 changes: 2 additions & 0 deletions
2
...ion-tests/gradle/src/main/resources/composite-project-with-dependencies/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 |
43 changes: 43 additions & 0 deletions
43
...le/src/test/java/io/quarkus/gradle/devmode/CompositeBuildWithDependenciesDevModeTest.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,43 @@ | ||
package io.quarkus.gradle.devmode; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
|
||
public class CompositeBuildWithDependenciesDevModeTest extends QuarkusDevGradleTestBase { | ||
|
||
@Override | ||
protected String projectDirectoryName() { | ||
return "composite-project-with-dependencies"; | ||
} | ||
|
||
@Override | ||
protected String[] buildArguments() { | ||
return new String[] { "clean", "quarkusDev" }; | ||
} | ||
|
||
@Override | ||
protected void testDevMode() throws Exception { | ||
assertThat(getHttpResponse("/product")).contains("[]"); | ||
} | ||
|
||
@Override | ||
protected File getProjectDir() { | ||
File projectDir = super.getProjectDir(); | ||
final File restAppProjectProperties = new File(projectDir, "gradle-rest/gradle.properties"); | ||
final File daoAppProjectProperties = new File(projectDir, "gradle-dao/gradle.properties"); | ||
final Path projectProperties = projectDir.toPath().resolve("gradle.properties"); | ||
|
||
try { | ||
Files.copy(projectProperties, restAppProjectProperties.toPath()); | ||
Files.copy(projectProperties, daoAppProjectProperties.toPath()); | ||
} catch (IOException e) { | ||
throw new IllegalStateException("Unable to copy gradle.properties file", e); | ||
} | ||
this.projectDir = restAppProjectProperties.getParentFile(); | ||
return this.projectDir; | ||
} | ||
} |