Browse Source
Compilation of AOT-generated source code requires runtime dependencies to be on the classpath. This is necessary as a class from a runtime dependency may appear in the signature of a generated method that defines a bean. To accomplish this, Boot's AOT plugin sets the org.gradle.usage attribute of the compile classpath configurations of the aot and aotTest source sets to java-runtime. When the Kotlin plugin is applied after Boot's AOT plugin it breaks this arrangement by setting org.gradle.usage to java-api. There doesn't appear to be a way to prevent it from messing with the aot and aotTest source sets despite them not using Kotlin. This commit works around the problem by repairing the damage and setting the attribute back to java-runtime again. Fixes gh-46397pull/46604/head
5 changed files with 136 additions and 1 deletions
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
/* |
||||
* Copyright 2012-present the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the License); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* https://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
plugins { |
||||
id 'org.springframework.boot' |
||||
id 'org.springframework.boot.aot' |
||||
id 'java' |
||||
id 'org.jetbrains.kotlin.jvm' |
||||
} |
||||
|
||||
repositories { |
||||
mavenCentral() |
||||
} |
||||
|
||||
dependencies { |
||||
implementation "org.hibernate.orm:hibernate-core:6.1.1.Final" |
||||
} |
||||
|
||||
task('compileAotJavaClasspath') { |
||||
doFirst { |
||||
tasks.findByName('compileAotJava').classpath.files.each { println it } |
||||
} |
||||
} |
||||
@ -0,0 +1,49 @@
@@ -0,0 +1,49 @@
|
||||
/* |
||||
* Copyright 2012-present the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the License); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* https://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
plugins { |
||||
id 'org.springframework.boot' |
||||
id 'org.springframework.boot.aot' |
||||
id 'java' |
||||
id "org.jetbrains.kotlin.jvm" |
||||
} |
||||
|
||||
repositories { |
||||
mavenCentral() |
||||
maven { |
||||
url = 'repository' |
||||
} |
||||
} |
||||
|
||||
configurations.all { |
||||
resolutionStrategy { |
||||
eachDependency { |
||||
if (it.requested.group == 'org.springframework.boot') { |
||||
it.useVersion project.bootVersion |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
dependencies { |
||||
implementation "org.hibernate.orm:hibernate-core:6.1.1.Final" |
||||
} |
||||
|
||||
task('compileAotTestJavaClasspath') { |
||||
doFirst { |
||||
tasks.findByName('compileAotTestJava').classpath.files.each { println it } |
||||
} |
||||
} |
||||
Loading…
Reference in new issue