HHH-9679 - Fix hibernate-enhance-maven-plugin buid script

This commit is contained in:
barreiro 2015-03-26 01:41:23 +00:00 committed by Steve Ebersole
parent 3b9b2eaa91
commit 81d30aa037
7 changed files with 39 additions and 56 deletions

4
.gitignore vendored
View File

@ -40,7 +40,3 @@ ObjectStore
# Profiler and heap dumps
*.jps
*.hprof
# Maven Enhance Plugin
tooling/hibernate-enhance-maven-plugin/src/main/resources/pom.xml
tooling/hibernate-enhance-maven-plugin/src/main/resources/META-INF/maven/plugin.xml

View File

@ -1415,7 +1415,7 @@ hibernate.cache.use_structured_entries true</programlisting>
the compile task as the source location of entity class files to enhance.
<programlisting>apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'enhance'
apply plugin: 'hibernate'
buildscript {
repositories {
mavenCentral()
@ -1426,7 +1426,6 @@ buildscript {
}
dependencies {
compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-[SPEC-VERSION]-api', version: '[IMPL-VERSION]'
compile group: 'org.hibernate', name: 'hibernate-gradle-plugin', version: 'VERSION'
}
</programlisting>
</para>

View File

@ -26,9 +26,8 @@ project(':metamodel-generator').name = 'hibernate-jpamodelgen'
include 'hibernate-gradle-plugin'
project(':hibernate-gradle-plugin').projectDir = new File(rootProject.projectDir, "tooling/hibernate-gradle-plugin")
// Temporarily disabled : HHH-9679
//include 'hibernate-enhance-maven-plugin'
//project(':hibernate-enhance-maven-plugin').projectDir = new File(rootProject.projectDir, "tooling/hibernate-enhance-maven-plugin")
include 'hibernate-enhance-maven-plugin'
project(':hibernate-enhance-maven-plugin').projectDir = new File(rootProject.projectDir, "tooling/hibernate-enhance-maven-plugin")
rootProject.children.each { project ->
project.buildFileName = "${project.name}.gradle"

View File

@ -9,13 +9,10 @@ repositories {
mavenCentral()
}
processResources.doLast {
project.build.outputDirectory = '${project.build.outputDirectory}'
copy {
from 'src/main/resources'
into processResources.destinationDir
expand ([ version: version, project: project, dir: '${dir}' ])
}
processResources {
include "**/plugin-help.xml"
into processResources.destinationDir
filter(ReplaceTokens, tokens: ['version' : project.version])
}
dependencies {
@ -39,11 +36,10 @@ dependencies {
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' :\
from "src/main/resources/META-INF/maven/plugin.xml"
into "$processResources.destinationDir/META-INF/maven"
filter(ReplaceTokens, tokens: ['version' : project.version, 'generated-dependencies' :\
generateMavenDependency(libraries.jpa)\
+ generateMavenDependency(libraries.antlr)\
+ generateMavenDependency(libraries.dom4j)\
@ -58,16 +54,16 @@ task processPluginXml(type: Copy) {
// 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"
return "\n<dependency>"\
+ "\n <groupId>" + split[0] + "</groupId>"\
+ "\n <artifactId>" + split[1] + "</artifactId>"\
+ "\n <version>" + split[2] + "</version>"\
+ "\n <type>jar</type>"\
+ "\n</dependency>"
}
task writeNewPom(type:Task, description: 'Writes pom.xml using merged Gradle dependency and MavenPom configuration.') {
// Writes pom.xml using merged Gradle dependency and MavenPom configuration.
processResources.doLast {
ext.pomDefinition = pom {
configurations {
// avoiding test dependencies in generated pom
@ -79,34 +75,27 @@ task writeNewPom(type:Task, description: 'Writes pom.xml using merged Gradle dep
groupId project.group
packaging 'maven-plugin'
name 'Enhance Plugin of the Hibernate project for use with Maven build system.'
build {
plugins {
plugin {
groupId 'org.apache.maven.plugins'
artifactId 'maven-plugin-plugin'
version '3.2'
configuration {
skipErrorNoDescriptorsFound 'true'
}
executions {
execution {
id 'mojo-descriptor'
goals {
goal 'descriptor'
}
}
}
}
}
}
properties {
'project.build.sourceEncoding' 'UTF-8'
}
}
}
ext.pomDefinition.writeTo("$projectDir/src/main/resources/pom.xml")
// HHH-9679 --- build in pom{} conflicts with FactoryBuilderSupport#build so we write that portion of XML by hand
ext.pomDefinition.withXml {
asNode().appendNode('build').appendNode('plugins').appendNode('plugin').with {
appendNode('groupId', 'org.apache.maven.plugins')
appendNode('artifactId', 'maven-plugin-plugin')
appendNode('version', '3.2')
appendNode('configuration').appendNode('skipErrorNoDescriptorsFound', 'true')
appendNode('executions').appendNode('execution').with {
appendNode('id', 'mojo-descriptor')
appendNode('goals').appendNode('goal', 'descriptor')
}
}
}
ext.pomDefinition.writeTo("$processResources.destinationDir/pom.xml")
}
writeNewPom.dependsOn processPluginXml
processResources.dependsOn writeNewPom
processResources.dependsOn processPluginXml

View File

@ -7,7 +7,7 @@
<description></description>
<groupId>org.hibernate.orm.tooling</groupId>
<artifactId>hibernate-enhance-maven-plugin</artifactId>
<version>${version}</version>
<version>@version@</version>
<goalPrefix>hibernate-enhance</goalPrefix>
<mojos>
<mojo>

View File

@ -7,7 +7,7 @@
<description></description>
<groupId>org.hibernate.orm.tooling</groupId>
<artifactId>hibernate-enhance-maven-plugin</artifactId>
<version>${version}</version>
<version>@version@</version>
<goalPrefix>hibernate-enhance</goalPrefix>
<mojos/>
</plugin>

View File

@ -7,7 +7,7 @@
<description></description>
<groupId>org.hibernate.orm.tooling</groupId>
<artifactId>hibernate-enhance-maven-plugin</artifactId>
<version>${version}</version>
<version>@version@</version>
<goalPrefix>hibernate-enhance</goalPrefix>
<isolatedRealm>false</isolatedRealm>
<inheritedByDefault>true</inheritedByDefault>