2015-05-19 00:23:35 -04:00
|
|
|
/*
|
|
|
|
* Hibernate, Relational Persistence for Idiomatic Java
|
|
|
|
*
|
|
|
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
|
|
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
|
|
|
*/
|
2013-12-19 10:09:40 -05:00
|
|
|
apply plugin: 'java'
|
|
|
|
apply plugin: 'maven'
|
|
|
|
|
2014-01-31 11:39:02 -05:00
|
|
|
import org.apache.tools.ant.filters.ReplaceTokens
|
|
|
|
|
2013-12-19 10:09:40 -05:00
|
|
|
group = 'org.hibernate.orm.tooling'
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
|
2015-03-25 21:41:23 -04:00
|
|
|
processResources {
|
2016-11-29 12:20:12 -05:00
|
|
|
include "**/lifecycle-mapping-metadata.xml"
|
2015-03-25 21:41:23 -04:00
|
|
|
include "**/plugin-help.xml"
|
|
|
|
into processResources.destinationDir
|
|
|
|
filter(ReplaceTokens, tokens: ['version' : project.version])
|
2013-12-19 10:09:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2015-09-28 23:19:32 -04:00
|
|
|
compile( libraries.maven_core ) { transitive = false }
|
|
|
|
compile( libraries.maven_artifact ) { transitive = false }
|
2014-01-31 11:39:02 -05:00
|
|
|
compile( libraries.maven_plugin ) { transitive = false }
|
|
|
|
compile( libraries.maven_plugin_tools ) { transitive = false }
|
|
|
|
compile( project(':hibernate-core') ) { transitive = false }
|
|
|
|
compile( libraries.jpa ) { transitive = false }
|
|
|
|
compile( libraries.javassist ) { transitive = false }
|
2016-10-04 16:43:27 -04:00
|
|
|
compile( libraries.byteBuddy ) { transitive = false }
|
2013-12-19 10:09:40 -05:00
|
|
|
compile 'org.codehaus.plexus:plexus-utils:3.0.1'
|
2016-11-29 12:20:12 -05:00
|
|
|
compile 'org.sonatype.plexus:plexus-build-api:0.0.7'
|
2015-09-28 23:19:32 -04:00
|
|
|
runtime( libraries.maven_core )
|
|
|
|
runtime( libraries.maven_artifact )
|
2014-01-31 11:39:02 -05:00
|
|
|
runtime( libraries.maven_plugin )
|
|
|
|
runtime( libraries.maven_plugin_tools )
|
|
|
|
runtime( project(':hibernate-core') )
|
|
|
|
runtime( libraries.jpa )
|
2017-01-26 12:21:37 -05:00
|
|
|
runtime( libraries.jta )
|
2014-01-31 11:39:02 -05:00
|
|
|
runtime( libraries.javassist )
|
2016-10-04 16:43:27 -04:00
|
|
|
runtime( libraries.byteBuddy )
|
2013-12-19 10:09:40 -05:00
|
|
|
runtime 'org.codehaus.plexus:plexus-utils:3.0.1'
|
|
|
|
}
|
|
|
|
|
2014-01-31 11:39:02 -05:00
|
|
|
// 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)
|
2015-03-25 21:41:23 -04:00
|
|
|
|
|
|
|
from "src/main/resources/META-INF/maven/plugin.xml"
|
|
|
|
into "$processResources.destinationDir/META-INF/maven"
|
|
|
|
filter(ReplaceTokens, tokens: ['version' : project.version, 'generated-dependencies' :\
|
2014-01-31 11:39:02 -05:00
|
|
|
generateMavenDependency(libraries.jpa)\
|
|
|
|
+ generateMavenDependency(libraries.antlr)\
|
|
|
|
+ generateMavenDependency(libraries.dom4j)\
|
|
|
|
+ generateMavenDependency(libraries.jta)\
|
|
|
|
+ generateMavenDependency(libraries.commons_annotations)\
|
|
|
|
+ generateMavenDependency(libraries.javassist)\
|
2016-10-04 16:43:27 -04:00
|
|
|
+ generateMavenDependency(libraries.byteBuddy)\
|
2014-01-31 11:39:02 -05:00
|
|
|
+ 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(":")
|
2015-03-25 21:41:23 -04:00
|
|
|
return "\n<dependency>"\
|
|
|
|
+ "\n <groupId>" + split[0] + "</groupId>"\
|
|
|
|
+ "\n <artifactId>" + split[1] + "</artifactId>"\
|
|
|
|
+ "\n <version>" + split[2] + "</version>"\
|
|
|
|
+ "\n <type>jar</type>"\
|
|
|
|
+ "\n</dependency>"
|
2014-01-31 11:39:02 -05:00
|
|
|
}
|
|
|
|
|
2015-03-25 21:41:23 -04:00
|
|
|
// Writes pom.xml using merged Gradle dependency and MavenPom configuration.
|
|
|
|
processResources.doLast {
|
2013-12-19 10:09:40 -05:00
|
|
|
ext.pomDefinition = pom {
|
2014-02-04 12:30:53 -05:00
|
|
|
configurations {
|
|
|
|
// avoiding test dependencies in generated pom
|
|
|
|
compile
|
|
|
|
runtime
|
|
|
|
}
|
|
|
|
|
2013-12-19 10:09:40 -05:00
|
|
|
project {
|
|
|
|
groupId project.group
|
|
|
|
packaging 'maven-plugin'
|
2015-05-22 02:23:04 -04:00
|
|
|
name 'Hibernate Enhance Maven Plugin'
|
2015-04-30 00:21:38 -04:00
|
|
|
description 'Enhance Plugin of the Hibernate project for use with Maven build system.'
|
2013-12-19 10:09:40 -05:00
|
|
|
properties {
|
|
|
|
'project.build.sourceEncoding' 'UTF-8'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-25 21:41:23 -04:00
|
|
|
// 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")
|
|
|
|
}
|
2013-12-19 10:09:40 -05:00
|
|
|
|
2015-03-25 21:41:23 -04:00
|
|
|
processResources.dependsOn processPluginXml
|
2015-04-30 00:30:20 -04:00
|
|
|
|
|
|
|
mavenPom {
|
|
|
|
name = 'Enhance Plugin of the Hibernate project for use with Maven build system.'
|
|
|
|
description = 'Enhance Plugin of the Hibernate project for use with Maven build system.'
|
2016-11-29 12:20:12 -05:00
|
|
|
}
|