Slackbot
10/14/2022, 11:39 AMJavi
10/14/2022, 11:45 AMtasks.testDependsOnPublishToMavenLocalTestFrom(projects.composeResources)
Javi
10/14/2022, 11:46 AMSteve Ebersole
10/14/2022, 11:49 AMThomas Broyer
10/14/2022, 11:50 AMpluginUnderTestMetadata
task's pluginClasspath
.
val additionalPluginClasspath by configurations.creating
dependencies {
additionalPluginClasspath(project(":foo"))
}
tasks {
pluginUnderTestMetadata {
pluginClasspath.from(additionalPluginClasspath)
}
}
then withPluginClasspath
inside the tests will have project ":foo" in it.Steve Ebersole
10/14/2022, 11:50 AMSteve Ebersole
10/14/2022, 11:51 AMSteve Ebersole
10/14/2022, 11:52 AMpluginClasspath.from(additionalPluginClasspath)
is additive?Thomas Broyer
10/14/2022, 11:56 AMsetFrom()
(or from =
) would replace the default value.Vampire
10/14/2022, 12:05 PMWe try very hard to neither publish to nor consume from mavenLocal. It has caused me problems many timesVery wise actually, as it is not a pure repo, but also a caching proxy for Maven. π But what you can always do too is to publish to a different local repository, just some path somewhere, for example in the
buildDirectory
.
Unless you need it for cross-build coordination, it is probably always preferable over mavenLocal()
.Steve Ebersole
10/14/2022, 12:08 PMconfigurations {
additionalPluginTestClasspath
}
dependencies {
...
implementation project(':hibernate-core')
additionalPluginTestClasspath project(':hibernate-core')
}
tasks {
pluginUnderTestMetadata {
pluginClasspath.from configurations.additionalPluginTestClasspath
}
}
But still end up with test failures because:
> Could not find org.hibernate.orm:hibernate-core:6.1.3-SNAPSHOT.
Thomas Broyer
10/14/2022, 12:10 PMSteve Ebersole
10/14/2022, 12:10 PMSteve Ebersole
10/14/2022, 12:11 PMThomas Broyer
10/14/2022, 12:11 PMSteve Ebersole
10/14/2022, 12:12 PMSteve Ebersole
10/14/2022, 12:12 PMThomas Broyer
10/14/2022, 12:15 PMSteve Ebersole
10/14/2022, 12:16 PMSteve Ebersole
10/14/2022, 12:16 PMThomas Broyer
10/14/2022, 12:20 PMSteve Ebersole
10/14/2022, 12:21 PMSteve Ebersole
10/14/2022, 12:21 PMSteve Ebersole
10/14/2022, 12:22 PMThomas Broyer
10/14/2022, 12:22 PMdependencies {}
of the build driven by TestKit?Steve Ebersole
10/14/2022, 12:24 PMhibernate-core
Steve Ebersole
10/14/2022, 12:25 PMhibernate-core
which it therefore needs as an implementation detailSteve Ebersole
10/14/2022, 12:27 PMhibernate-core
. That project is defined as:
plugins {
id 'java'
id 'org.hibernate.orm'
}
dependencies {
implementation 'org.hibernate.orm:hibernate-core:6.1.0.Final'
}
hibernate {
// DSL block
}
Steve Ebersole
10/14/2022, 12:28 PMSteve Ebersole
10/14/2022, 12:29 PMThomas Broyer
10/14/2022, 12:30 PMrepository {}
the resolve the dependency from.Steve Ebersole
10/14/2022, 12:31 PMhibernate-core
relative to id 'org.hibernate.orm'
Steve Ebersole
10/14/2022, 12:32 PM.Final
reference. It is complaining about resolving a SNAPSHOT
referenceThomas Broyer
10/14/2022, 12:32 PMSteve Ebersole
10/14/2022, 12:33 PMSteve Ebersole
10/14/2022, 12:33 PMSteve Ebersole
10/14/2022, 12:33 PMSteve Ebersole
10/14/2022, 12:34 PMSteve Ebersole
10/14/2022, 12:34 PMThomas Broyer
10/14/2022, 12:35 PMThomas Broyer
10/14/2022, 12:35 PMSteve Ebersole
10/14/2022, 12:35 PMThomas Broyer
10/14/2022, 12:36 PMThomas Broyer
10/14/2022, 12:36 PMSteve Ebersole
10/14/2022, 12:37 PMSteve Ebersole
10/14/2022, 12:37 PMSteve Ebersole
10/14/2022, 12:38 PMSteve Ebersole
10/14/2022, 12:38 PMSteve Ebersole
10/14/2022, 12:38 PMSteve Ebersole
10/14/2022, 12:39 PMThomas Broyer
10/14/2022, 12:40 PMSteve Ebersole
10/14/2022, 12:40 PMThomas Broyer
10/14/2022, 12:41 PMSteve Ebersole
10/14/2022, 12:41 PMThomas Broyer
10/14/2022, 12:42 PMSteve Ebersole
10/14/2022, 12:42 PMThomas Broyer
10/14/2022, 12:51 PMincludeBuild(System.getProperty("test.hibernate-project-path"))
and add the following to TestKit's `withArguments()`: "-Dtest.hibernate-project-path=" + Path.of("../../").toAbsolutePath()
Steve Ebersole
10/14/2022, 12:51 PMincludeBuild
with relative path up-to hibernate-core
2. Change the test's project.gradle to use implementation project('hibernate-core')
3. 3. Do the `pluginClasspath.from`stuff you mentioned earlier
correct?Steve Ebersole
10/14/2022, 12:52 PMSteve Ebersole
10/14/2022, 12:52 PMincludeBuild "../../../../../../hibernate-core"
Steve Ebersole
10/14/2022, 12:52 PMSteve Ebersole
10/14/2022, 12:52 PMSteve Ebersole
10/14/2022, 12:53 PMorg.gradle.api.InvalidUserDataException: A path must be specified!
Steve Ebersole
10/14/2022, 12:53 PMSteve Ebersole
10/14/2022, 12:54 PMThomas Broyer
10/14/2022, 12:59 PMThomas Broyer
10/14/2022, 1:02 PMSteve Ebersole
10/14/2022, 1:04 PMSteve Ebersole
10/14/2022, 1:05 PM// useSameVersion = false
Steve Ebersole
10/14/2022, 1:06 PMThomas Broyer
10/14/2022, 1:09 PMdiff --git a/tooling/hibernate-gradle-plugin/src/test/resources/projects/simple/build.gradle b/tooling/hibernate-gradle-plugin/src/test/resources/projects/simple/build.gradle
index 20bc5d3..1f34c4b 100644
--- a/tooling/hibernate-gradle-plugin/src/test/resources/projects/simple/build.gradle
+++ b/tooling/hibernate-gradle-plugin/src/test/resources/projects/simple/build.gradle
@@ -27,7 +27,7 @@ dependencies {
hibernate {
// to get using the same version to work, we'd have to install hibernate-core into maven local prior to running these.
// suck we won't be able to adequately test this part, but
- useSameVersion = false
+ // useSameVersion = false
enhancement {
lazyInitialization( true )
dirtyTracking = true
diff --git a/tooling/hibernate-gradle-plugin/src/test/resources/projects/simple/settings.gradle b/tooling/hibernate-gradle-plugin/src/test/resources/projects/simple/settings.gradle
index e69de29..e823638 100644
--- a/tooling/hibernate-gradle-plugin/src/test/resources/projects/simple/settings.gradle
+++ b/tooling/hibernate-gradle-plugin/src/test/resources/projects/simple/settings.gradle
@@ -0,0 +1 @@
+includeBuild(System.getProperty("test.hibernate-project-path"))
diff --git a/tooling/hibernate-gradle-plugin/src/test/java/org/hibernate/orm/tooling/gradle/JavaProjectTests.java b/tooling/hibernate-gradle-plugin/src/test/java/org/hibernate/orm/tooling/gradle/JavaProjectTests
.java
index 16b07d2..b5d5903 100644
--- a/tooling/hibernate-gradle-plugin/src/test/java/org/hibernate/orm/tooling/gradle/JavaProjectTests.java
+++ b/tooling/hibernate-gradle-plugin/src/test/java/org/hibernate/orm/tooling/gradle/JavaProjectTests.java
@@ -36,7 +36,7 @@ class JavaProjectTests {
.withProjectDir( projectDir.toFile() )
.withPluginClasspath()
.withDebug( true )
- .withArguments( "clean", "compileJava", "--stacktrace", "--no-build-cache" )
+ .withArguments( "clean", "compileJava", "--stacktrace", "--no-build-cache", "-Dtest.hibernate-project-path=" + Path.of("../../").toAbsolutePath() )
.forwardOutput();
(repeat last change for each withArguments()
, repeat changes for Kotlin tests)Thomas Broyer
10/14/2022, 1:10 PMBUILD SUCCESSFUL in 56s
21 actionable tasks: 2 executed, 19 up-to-date
Steve Ebersole
10/15/2022, 1:45 PM