apply plugin: 'java' apply plugin: 'maven' group = 'org.hibernate.orm.tooling' 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}' ]) } } dependencies { 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 } compile 'org.codehaus.plexus:plexus-utils:3.0.1' runtime( libraries.maven_plugin ) { } runtime( libraries.maven_plugin_tools ) { } runtime( project(':hibernate-core') ) { } runtime( libraries.jpa ){ } runtime( libraries.javassist ){ } runtime 'org.codehaus.plexus:plexus-utils:3.0.1' } // avoiding test dependencies in generated pom configurations.remove(configurations.getByName('testCompile')) configurations.remove(configurations.getByName('testRuntime')) task writeNewPom(type:Task, description: 'Writes pom.xml using merged Gradle dependency and MavenPom configuration.') { ext.pomDefinition = pom { project { 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") } processResources.dependsOn writeNewPom