HHH-8777 dynamically generate descriptor dependencies
Conflicts: .gitignore hibernate-enhance-maven-plugin/src/main/resources/META-INF/maven/plugin.xml hibernate-enhance-maven-plugin/src/main/resources/META-INF/maven/plugin.xml.original tooling/hibernate-enhance-maven-plugin/src/main/resources/META-INF/maven/plugin.xml
This commit is contained in:
parent
be4f2e186d
commit
518bda7a43
|
@ -43,3 +43,4 @@ ObjectStore
|
||||||
|
|
||||||
# Maven Enhance Plugin
|
# Maven Enhance Plugin
|
||||||
tooling/hibernate-enhance-maven-plugin/src/main/resources/pom.xml
|
tooling/hibernate-enhance-maven-plugin/src/main/resources/pom.xml
|
||||||
|
tooling/hibernate-enhance-maven-plugin/src/main/resources/META-INF/maven/plugin.xml
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'maven'
|
apply plugin: 'maven'
|
||||||
|
|
||||||
|
import org.apache.tools.ant.filters.ReplaceTokens
|
||||||
|
|
||||||
group = 'org.hibernate.orm.tooling'
|
group = 'org.hibernate.orm.tooling'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -17,33 +19,17 @@ processResources.doLast {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile( libraries.maven_plugin ) {
|
compile( libraries.maven_plugin ) { transitive = false }
|
||||||
transitive = false
|
compile( libraries.maven_plugin_tools ) { transitive = false }
|
||||||
}
|
compile( project(':hibernate-core') ) { transitive = false }
|
||||||
compile( libraries.maven_plugin_tools ) {
|
compile( libraries.jpa ) { transitive = false }
|
||||||
transitive = false
|
compile( libraries.javassist ) { transitive = false }
|
||||||
}
|
|
||||||
compile( project(':hibernate-core') ) {
|
|
||||||
transitive = false
|
|
||||||
}
|
|
||||||
compile( libraries.jpa ){
|
|
||||||
transitive = false
|
|
||||||
}
|
|
||||||
compile( libraries.javassist ){
|
|
||||||
transitive = false
|
|
||||||
}
|
|
||||||
compile 'org.codehaus.plexus:plexus-utils:3.0.1'
|
compile 'org.codehaus.plexus:plexus-utils:3.0.1'
|
||||||
|
runtime( libraries.maven_plugin )
|
||||||
runtime( libraries.maven_plugin ) {
|
runtime( libraries.maven_plugin_tools )
|
||||||
}
|
runtime( project(':hibernate-core') )
|
||||||
runtime( libraries.maven_plugin_tools ) {
|
runtime( libraries.jpa )
|
||||||
}
|
runtime( libraries.javassist )
|
||||||
runtime( project(':hibernate-core') ) {
|
|
||||||
}
|
|
||||||
runtime( libraries.jpa ){
|
|
||||||
}
|
|
||||||
runtime( libraries.javassist ){
|
|
||||||
}
|
|
||||||
runtime 'org.codehaus.plexus:plexus-utils:3.0.1'
|
runtime 'org.codehaus.plexus:plexus-utils:3.0.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +37,41 @@ dependencies {
|
||||||
configurations.remove(configurations.getByName('testCompile'))
|
configurations.remove(configurations.getByName('testCompile'))
|
||||||
configurations.remove(configurations.getByName('testRuntime'))
|
configurations.remove(configurations.getByName('testRuntime'))
|
||||||
|
|
||||||
task writeNewPom(type:Task, description: 'Writes pom.xml using merged Gradle dependency and MavenPom configuration.') {
|
// Inject dependencies into plugin.xml
|
||||||
|
// Note: injecting the full dependency, rather than just the version,
|
||||||
|
// removing the need to maintain artifact names that might change with upgrades (JPA/JTA API version, etc.)
|
||||||
|
task processPluginXml(type: Copy) {
|
||||||
|
// force out-of-date if version changes
|
||||||
|
inputs.property("version", project.version)
|
||||||
|
|
||||||
|
from "src/main/resources/META-INF/maven/plugin.xml.original"
|
||||||
|
into "src/main/resources/META-INF/maven"
|
||||||
|
rename ("plugin.xml.original", "plugin.xml")
|
||||||
|
filter(ReplaceTokens, tokens: ['generated-dependencies' :\
|
||||||
|
generateMavenDependency(libraries.jpa)\
|
||||||
|
+ generateMavenDependency(libraries.antlr)\
|
||||||
|
+ generateMavenDependency(libraries.dom4j)\
|
||||||
|
+ generateMavenDependency(libraries.jta)\
|
||||||
|
+ generateMavenDependency(libraries.commons_annotations)\
|
||||||
|
+ generateMavenDependency(libraries.javassist)\
|
||||||
|
+ generateMavenDependency(libraries.logging)\
|
||||||
|
+ generateMavenDependency("org.hibernate:hibernate-core:" + project.version)])
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: There may be a way to do this directly with Gradle's Maven plugin, but it's still incubating
|
||||||
|
// and I'd rather not rely on it yet.
|
||||||
|
def generateMavenDependency(String gradleDependency) {
|
||||||
|
String[] split = gradleDependency.split(":")
|
||||||
|
return \
|
||||||
|
"<dependency>"\
|
||||||
|
+ "<groupId>" + split[0] + "</groupId>"\
|
||||||
|
+ "<artifactId>" + split[1] + "</artifactId>"\
|
||||||
|
+ "<type>jar</type>"\
|
||||||
|
+ "<version>" + split[2] + "</version>"\
|
||||||
|
+ "</dependency>\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
task writeNewPom(type:Task, description: 'Writes pom.xml using merged Gradle dependency and MavenPom configuration.') {
|
||||||
ext.pomDefinition = pom {
|
ext.pomDefinition = pom {
|
||||||
project {
|
project {
|
||||||
groupId project.group
|
groupId project.group
|
||||||
|
@ -85,5 +105,6 @@ task writeNewPom(type:Task, description: 'Writes pom.xml using merged Gradle dep
|
||||||
ext.pomDefinition.writeTo("$projectDir/src/main/resources/pom.xml")
|
ext.pomDefinition.writeTo("$projectDir/src/main/resources/pom.xml")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
writeNewPom.dependsOn processPluginXml
|
||||||
processResources.dependsOn writeNewPom
|
processResources.dependsOn writeNewPom
|
||||||
|
|
||||||
|
|
|
@ -44,12 +44,9 @@
|
||||||
</mojo>
|
</mojo>
|
||||||
</mojos>
|
</mojos>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<!-- Generated by Gradle -->
|
||||||
<groupId>org.jboss.logging</groupId>
|
@generated-dependencies@
|
||||||
<artifactId>jboss-logging</artifactId>
|
|
||||||
<type>jar</type>
|
|
||||||
<version>3.1.0.GA</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-utils</artifactId>
|
<artifactId>plexus-utils</artifactId>
|
||||||
|
@ -68,42 +65,6 @@
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<version>3.0</version>
|
<version>3.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.hibernate</groupId>
|
|
||||||
<artifactId>hibernate-core</artifactId>
|
|
||||||
<type>jar</type>
|
|
||||||
<version>4.2.8.Final</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>antlr</groupId>
|
|
||||||
<artifactId>antlr</artifactId>
|
|
||||||
<type>jar</type>
|
|
||||||
<version>2.7.7</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>dom4j</groupId>
|
|
||||||
<artifactId>dom4j</artifactId>
|
|
||||||
<type>jar</type>
|
|
||||||
<version>1.6.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jboss.spec.javax.transaction</groupId>
|
|
||||||
<artifactId>jboss-transaction-api_1.1_spec</artifactId>
|
|
||||||
<type>jar</type>
|
|
||||||
<version>1.0.1.Final</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.hibernate.common</groupId>
|
|
||||||
<artifactId>hibernate-commons-annotations</artifactId>
|
|
||||||
<type>jar</type>
|
|
||||||
<version>4.0.2.Final</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.hibernate.javax.persistence</groupId>
|
|
||||||
<artifactId>hibernate-jpa-2.0-api</artifactId>
|
|
||||||
<type>jar</type>
|
|
||||||
<version>1.0.1.Final</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven</groupId>
|
<groupId>org.apache.maven</groupId>
|
||||||
<artifactId>maven-plugin-api</artifactId>
|
<artifactId>maven-plugin-api</artifactId>
|
||||||
|
@ -152,11 +113,5 @@
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<version>0.9.9</version>
|
<version>0.9.9</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.javassist</groupId>
|
|
||||||
<artifactId>javassist</artifactId>
|
|
||||||
<type>jar</type>
|
|
||||||
<version>3.18.1-GA</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</plugin>
|
</plugin>
|
Loading…
Reference in New Issue