-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add possibility to upload to maven central to build.gradle
- Loading branch information
1 parent
5493f52
commit 317ff2c
Showing
3 changed files
with
132 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.gradle | ||
build | ||
out | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.classpath | ||
.project | ||
.settings | ||
bin | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,38 @@ | ||
apply plugin: 'maven' | ||
apply plugin: 'java' | ||
apply plugin: 'eclipse' | ||
apply plugin: 'idea' | ||
apply plugin: 'maven' | ||
apply plugin: 'signing' | ||
apply plugin: 'com.github.ben-manes.versions' | ||
|
||
group = 'de.otto' | ||
version = '0.0.3' | ||
ext.isReleaseVersion = !version.endsWith("SNAPSHOT") | ||
|
||
archivesBaseName = 'esiinclude-thymeleaf-dialect' | ||
archivesBaseName = 'esi-include-thymeleaf3-dialect' | ||
|
||
// Major Release: X.0.0: Breaking Changes | ||
// Minor Release: 0.X.0: Additional Features, updates from minor releases in edison | ||
// Micro Release: 0.0.X: Bugfixes, non-breaking changes, updates from micro releases in edison | ||
// DO NOT FORGET TO DOCUMENT CHANGES IN README.MD | ||
ext.pomVersion = '0.0.3' | ||
sourceCompatibility = 1.8 | ||
|
||
repositories { | ||
mavenCentral() | ||
maven { url "https://oss.sonatype.org/content/repositories/releases/" } | ||
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } | ||
} | ||
|
||
configurations.all { | ||
// check for updates every build | ||
// resolutionStrategy.cacheChangingModulesFor 0, 'seconds' | ||
exclude group: "org.slf4j", module: "slf4j-log4j12" | ||
exclude group: "log4j", module: "log4j" | ||
exclude module: "spring-boot-starter-tomcat" | ||
} | ||
|
||
ext.libraries = [ | ||
thymeleaf2: [ | ||
'org.thymeleaf:thymeleaf:2.1.5.RELEASE' | ||
], | ||
thymeleaf3 : [ | ||
'org.thymeleaf:thymeleaf:3.0.2.RELEASE', | ||
'org.thymeleaf:thymeleaf-spring4:3.0.2.RELEASE', | ||
'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:2.1.0' | ||
] | ||
thymeleaf2: [ | ||
'org.thymeleaf:thymeleaf:2.1.5.RELEASE' | ||
], | ||
thymeleaf3: [ | ||
'org.thymeleaf:thymeleaf:3.0.2.RELEASE', | ||
'org.thymeleaf:thymeleaf-spring4:3.0.2.RELEASE', | ||
'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:2.1.0' | ||
] | ||
] | ||
|
||
dependencies { | ||
compileOnly libraries.thymeleaf3 | ||
compileOnly group:'com.ning', name: 'async-http-client', version:'1.9.33' | ||
compileOnly group: 'com.ning', name: 'async-http-client', version: '1.9.33' | ||
|
||
compile group: 'org.springframework', name: 'spring-context', version: '4.3.4.RELEASE' | ||
compile group: 'org.springframework', name: 'spring-beans', version: '4.3.4.RELEASE' | ||
|
@@ -50,51 +45,97 @@ dependencies { | |
testCompile "org.hamcrest:hamcrest-library:1.3" | ||
} | ||
|
||
jar { | ||
manifest.attributes provider: 'gradle' | ||
} | ||
|
||
idea.project { | ||
jdkName = "1.8" | ||
languageLevel = "1.8" | ||
ipr.withXml { provider -> | ||
provider.node.component.find { it.@name == 'VcsDirectoryMappings' }.mapping.@vcs = 'Git' | ||
// for gradle plugins | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath 'com.github.ben-manes:gradle-versions-plugin:0.5' | ||
classpath 'org.codehaus.groovy:groovy-backports-compat23:2.3.5' | ||
} | ||
} | ||
|
||
tasks.processResources << { | ||
def resourcesDir = project.sourceSets.main.output.resourcesDir | ||
resourcesDir.mkdirs() | ||
|
||
def versionProperties = new File(resourcesDir, "version.properties") | ||
if (versionProperties) { | ||
def gitVersion = runCommand("git log -n 1 --format=format:%H") | ||
def fullVersion = fullyQualifiedVersion() | ||
versionProperties.text = "\nbuild.commit = ${gitVersion}" + "\nbuild.version = ${fullVersion}" | ||
} | ||
jar { | ||
manifest.attributes provider: 'gradle' | ||
} | ||
|
||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier = 'javadoc' | ||
from javadoc.destinationDir | ||
from 'build/docs/javadoc' | ||
} | ||
|
||
task sourcesJar(type: Jar, dependsOn: classes) { | ||
classifier = 'sources' | ||
task sourcesJar(type: Jar) { | ||
from sourceSets.main.allSource | ||
classifier = 'sources' | ||
} | ||
|
||
artifacts { | ||
archives sourcesJar | ||
archives jar | ||
archives javadocJar | ||
archives sourcesJar | ||
} | ||
|
||
install { | ||
repositories.mavenInstaller { | ||
pom.artifactId = archivesBaseName | ||
pom.groupId = 'de.otto' | ||
pom.version = pomVersion | ||
uploadArchives { | ||
repositories { | ||
mavenDeployer { | ||
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { | ||
authentication(userName: sonatypeUsername, password: sonatypePassword) | ||
} | ||
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { | ||
authentication(userName: sonatypeUsername, password: sonatypePassword) | ||
} | ||
|
||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } | ||
|
||
pom.project { | ||
name 'esi-include-thymeleaf3-dialect' | ||
packaging 'jar' | ||
description 'This library provides a thymeleaf3 dialect that resolves esi:include tags.' | ||
url 'http://github.com/otto-de/esi-include-thymeleaf3-dialect' | ||
|
||
scm { | ||
url 'scm:[email protected]:otto-de/esi-include-thymeleaf3-dialect.git' | ||
connection 'scm:[email protected]:otto-de/esi-include-thymeleaf3-dialect.git' | ||
developerConnection 'scm:[email protected]:otto-de/esi-include-thymeleaf3-dialect.git' | ||
} | ||
|
||
licenses { | ||
license { | ||
name 'The Apache Software License, Version 2.0' | ||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
distribution 'repo' | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id 'ffriedrich' | ||
name 'Frank Bregulla' | ||
} | ||
developer { | ||
id 'gsteinacker' | ||
name 'Guido Steinacker' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
task uploadLocal(type: Upload) { | ||
configuration = configurations.archives | ||
uploadDescriptor = true | ||
repositories { | ||
mavenLocal() | ||
} | ||
} | ||
|
||
signing { | ||
required { isReleaseVersion && gradle.taskGraph.hasTask(":uploadArchives") } | ||
sign configurations.archives | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
SCRIPT_DIR=$(dirname $0) | ||
|
||
USER_GRADLE_PROPERTIES=~/.gradle/gradle.properties | ||
|
||
check_configured() { | ||
grep -q $1 ${USER_GRADLE_PROPERTIES} || echo "$1 not configured in ${USER_GRADLE_PROPERTIES}. $2" | ||
} | ||
|
||
check_configuration() { | ||
if [ ! -f ${USER_GRADLE_PROPERTIES} ]; then | ||
echo "${USER_GRADLE_PROPERTIES} does not exist" | ||
exit 1 | ||
fi | ||
|
||
check_configured "sonatypeUsername" "This is the username you use to authenticate with sonatype nexus (e.g. otto-de)" | ||
check_configured "sonatypePassword" "This is the password you use to authenticate with sonatype nexus (ask Guido or one of the developers)" | ||
check_configured "signing.secretKeyRingFile" "This is the gpg secret key file, e.g. ~/.gnupg/secring.gpg. If this doesn't exist, generate a key: gpg --gen-key" | ||
check_configured "signing.keyId" "This is the id of your key (e.g. 72FE5380). Use gpg --list-keys to find yours" | ||
check_configured "signing.password" "This is the password you defined for your gpg key" | ||
# gpg --send-keys --keyserver keyserver.ubuntu.com yourKeyId | ||
} | ||
|
||
check_configuration | ||
|
||
${SCRIPT_DIR}/gradlew uploadArchives |