diff --git a/build.gradle b/build.gradle index 2a27e3b89f..1602bf2a85 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ buildscript { mavenRepo name: "jboss-snapshots", url: "http://snapshots.jboss.org/maven2/" } dependencies { - classpath 'org.hibernate.build.gradle:gradle-upload-auth-plugin:1.1.1' + classpath 'org.hibernate.build.gradle:gradle-maven-publish-auth:2.0.0' } } @@ -55,6 +55,14 @@ idea { } } +// Used in POM customization. Each sub-project overrides ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +def pomName() { + return "A Hibernate O/RM module" +} +def pomDescription() { + return "A module of the Hibernate O/RM project" +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ subprojects { subProject -> apply plugin: 'idea' @@ -69,8 +77,8 @@ subprojects { subProject -> buildDir = "target" if ( ! subProject.name.startsWith( 'release' ) && ! subProject.name.startsWith( 'documentation' ) ) { apply plugin: 'java' - apply plugin: 'maven' // for install task as well as deploy dependencies - apply plugin: 'uploadAuth' + apply plugin: 'maven-publish' + apply plugin: 'maven-publish-auth' apply plugin: 'osgi' apply from: "../utilities.gradle" @@ -91,16 +99,12 @@ subprojects { subProject -> hibernateJpaModelGenTool { description = "Dependencies for running the Hibernate JPA Metamodel Generator AnnotationProcessor tool" } - deployerJars { - description = 'Jars needed for doing deployment to JBoss Nexus repo' - } jaxb { description = 'Dependencies for running ant xjc (jaxb class generation)' } configurations { all*.exclude group: 'xml-apis', module: 'xml-apis' } - } // appropriately inject the common dependencies into each sub-project @@ -129,8 +133,6 @@ subprojects { subProject -> } jaxb( libraries.jaxb2_basics ) jaxb( libraries.jaxb2_ant ) - - deployerJars "org.apache.maven.wagon:wagon-http:1.0" } // mac-specific stuff ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -146,7 +148,7 @@ subprojects { subProject -> sourceCompatibility = rootProject.javaLanguageLevel task compile - compile.dependsOn compileJava, compileTestJava + compile.dependsOn compileJava, processResources, compileTestJava, processTestResources sourceSets.main { compileClasspath += configurations.provided @@ -273,9 +275,6 @@ subprojects { subProject -> } } ) - assemble.doLast( { install } ) - uploadArchives.dependsOn install - idea { module { iml { @@ -343,55 +342,59 @@ subprojects { subProject -> // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // elements used to customize the generated POM used during upload - def pomConfig = { - name 'A Hibernate O/RM Module' - description 'A module of the Hibernate O/RM project' - url 'http://hibernate.org' - organization { - name 'Hibernate.org' - url 'http://hibernate.org' - } - issueManagement { - system 'jira' - url 'http://opensource.atlassian.com/projects/hibernate/browse/HHH' - } - scm { - url "http://github.com/hibernate/hibernate-core" - connection "scm:git:http://github.com/hibernate/hibernate-core.git" - developerConnection "scm:git:git@github.com:hibernate/hibernate-core.git" - } - licenses { - license { - name 'GNU Lesser General Public License' - url 'http://www.gnu.org/licenses/lgpl-2.1.html' - comments 'See discussion at http://hibernate.org/license for more details.' - distribution 'repo' + publishing { + publications { + mavenJava(MavenPublication) { + from components.java + + artifact sourcesJar { + classifier "sources" + } + + pom.withXml { + def root = asNode(); + root.appendNode( 'name', subProject.pomName() ) + root.appendNode( 'description', subProject.pomDescription() ) + root.appendNode( 'url', 'http://hibernate.org' ) + def org = root.appendNode( 'organization' ) + org.appendNode( 'name', 'Hibernate.org' ) + org.appendNode( 'url', 'http://hibernate.org' ) + def jira = root.appendNode( 'issueManagement' ) + jira.appendNode( 'system', 'jira' ) + jira.appendNode( 'url', 'https://hibernate.atlassian.net/browse/HHH' ) + def scm = root.appendNode( 'scm' ) + scm.appendNode( 'url', 'http://github.com/hibernate/hibernate-orm' ) + scm.appendNode( 'connection', 'scm:git:http://github.com/hibernate/hibernate-orm.git' ) + scm.appendNode( 'developerConnection', 'scm:git:git@github.com:hibernate/hibernate-orm.git' ) + def license = root.appendNode( 'licenses' ).appendNode( 'license' ); + license.appendNode( 'name', 'GNU Lesser General Public License' ) + license.appendNode( 'url', 'http://www.gnu.org/licenses/lgpl-2.1.html' ) + license.appendNode( 'comments', 'See discussion at http://hibernate.org/license for more details.' ) + license.appendNode( 'distribution', 'repo' ) + def dev = root.appendNode( 'developers' ).appendNode( 'developer' ); + dev.appendNode( 'id', 'hibernate-team' ) + dev.appendNode( 'name', 'The Hibernate Development Team' ) + dev.appendNode( 'organization', 'Hibernate.org' ) + dev.appendNode( 'organizationUrl', 'http://hibernate.org' ) + } } } - developers { - developer { - id 'hibernate-team' - name 'The Hibernate Development Team' - organization 'Hibernate.org' - organizationUrl 'http://hibernate.org' + + repositories { + maven { + if ( subProject.version.endsWith( 'SNAPSHOT' ) ) { + name 'jboss-snapshots-repository' + url 'https://repository.jboss.org/nexus/content/repositories/snapshots' + } + else { + name 'jboss-releases-repository' + url 'https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/' + } } } - } - subProject.ext.basePomConfig = pomConfig - - configure(install.repositories.mavenInstaller) { - pom.project pomConfig - } - - uploadArchives { - repositories.mavenDeployer { - name = 'jbossDeployer' - configuration = configurations.deployerJars - pom.project pomConfig - repository(id: "jboss-releases-repository", url: "https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/") - snapshotRepository(id: "jboss-snapshots-repository", url: "https://repository.jboss.org/nexus/content/repositories/snapshots") + generatePomFileForMavenJavaPublication { + destination = file("$buildDir/generated-pom.xml") } } @@ -399,12 +402,6 @@ subprojects { subProject -> from sourceSets.main.allSource classifier = 'sources' } - - artifacts { - archives sourcesJar - } - - uploadArchives.dependsOn sourcesJar } } diff --git a/hibernate-c3p0/hibernate-c3p0.gradle b/hibernate-c3p0/hibernate-c3p0.gradle index 20e36fcf19..c149a9c1c1 100644 --- a/hibernate-c3p0/hibernate-c3p0.gradle +++ b/hibernate-c3p0/hibernate-c3p0.gradle @@ -10,6 +10,14 @@ dependencies { testCompile project( ':hibernate-testing' ) } +def pomName() { + return 'Hibernate/c3p0 Integration' +} + +def pomDescription() { + return 'Integration for c3p0 Connection pooling into Hibernate O/RM' +} + jar { manifest { instruction 'Bundle-Description', 'Hibernate ORM C3P0' diff --git a/hibernate-core/hibernate-core.gradle b/hibernate-core/hibernate-core.gradle index 5c18df40ed..e25693c139 100644 --- a/hibernate-core/hibernate-core.gradle +++ b/hibernate-core/hibernate-core.gradle @@ -33,6 +33,14 @@ dependencies { } +def pomName() { + return 'Core Hibernate O/RM functionality' +} + +def pomDescription() { + return 'The core O/RM functionality as provided by Hibernate' +} + manifest.mainAttributes( 'Main-Class': 'org.hibernate.Version' ) diff --git a/hibernate-ehcache/hibernate-ehcache.gradle b/hibernate-ehcache/hibernate-ehcache.gradle index 676a0e864c..78b0c84500 100644 --- a/hibernate-ehcache/hibernate-ehcache.gradle +++ b/hibernate-ehcache/hibernate-ehcache.gradle @@ -5,6 +5,14 @@ dependencies { testCompile project( ':hibernate-testing' ) } +def pomName() { + return 'Hibernate/Ehcache Integration' +} + +def pomDescription() { + return 'Integration for Ehcache into Hibernate as a second-level caching service' +} + jar { manifest { instruction 'Bundle-Description', 'Hibernate ORM EHCache' diff --git a/hibernate-entitymanager/hibernate-entitymanager.gradle b/hibernate-entitymanager/hibernate-entitymanager.gradle index 70d4ac5c92..e5a16948b3 100644 --- a/hibernate-entitymanager/hibernate-entitymanager.gradle +++ b/hibernate-entitymanager/hibernate-entitymanager.gradle @@ -24,6 +24,14 @@ dependencies { // testRuntime( "org.glassfish.web:el-impl:2.1.2-b04" ) } +def pomName() { + return 'Hibernate JPA Support' +} + +def pomDescription() { + return 'Hibernate O/RM implementation of the JPA specification' +} + jar { manifest { instruction 'Bundle-Description', 'Hibernate ORM JPA Entity Manager' diff --git a/hibernate-envers/hibernate-envers.gradle b/hibernate-envers/hibernate-envers.gradle index b3c647e8b8..2ae83fb18f 100644 --- a/hibernate-envers/hibernate-envers.gradle +++ b/hibernate-envers/hibernate-envers.gradle @@ -10,6 +10,14 @@ dependencies { testRuntime( libraries.javassist ) } +def pomName() { + return 'Entity versioning support' +} + +def pomDescription() { + return 'Entity versioning support' +} + sourceSets { main { ext.generatedJpaMetamodelSrcDir = file( "${buildDir}/generated-src/jpamodelgen/${name}" ) diff --git a/hibernate-infinispan/hibernate-infinispan.gradle b/hibernate-infinispan/hibernate-infinispan.gradle index ae6adca46a..2431c54e5d 100644 --- a/hibernate-infinispan/hibernate-infinispan.gradle +++ b/hibernate-infinispan/hibernate-infinispan.gradle @@ -16,6 +16,14 @@ dependencies { testCompile ('mysql:mysql-connector-java:5.1.17') } +def pomName() { + return 'Hibernate/Infinispan Integration' +} + +def pomDescription() { + return 'Integration for Infinispan into Hibernate as a second-level caching service' +} + test { systemProperties['java.net.preferIPv4Stack'] = true systemProperties['jgroups.ping.timeout'] = 500 diff --git a/hibernate-osgi/hibernate-osgi.gradle b/hibernate-osgi/hibernate-osgi.gradle index d5ce0a4811..8a01360d3c 100644 --- a/hibernate-osgi/hibernate-osgi.gradle +++ b/hibernate-osgi/hibernate-osgi.gradle @@ -4,6 +4,14 @@ dependencies { compile( "org.osgi:org.osgi.core:4.3.0" ) } +def pomName() { + return 'Hibernate OSGi Support' +} + +def pomDescription() { + return 'Support for running Hibernate O/RM in OSGi environments' +} + jar { manifest { instruction 'Bundle-Activator', 'org.hibernate.osgi.HibernateBundleActivator' diff --git a/hibernate-proxool/hibernate-proxool.gradle b/hibernate-proxool/hibernate-proxool.gradle index 77c3788721..e537f1c6d3 100644 --- a/hibernate-proxool/hibernate-proxool.gradle +++ b/hibernate-proxool/hibernate-proxool.gradle @@ -4,6 +4,14 @@ dependencies { testCompile project( ':hibernate-testing' ) } +def pomName() { + return 'Hibernate/Proxool Integration' +} + +def pomDescription() { + return 'Integration for Proxool Connection pooling into Hibernate O/RM' +} + jar { manifest { instruction 'Bundle-Description', 'Hibernate ORM Proxool'