upgrade to gradle 6.8.3
This commit is contained in:
parent
c51eb56007
commit
da014151d7
|
|
@ -9,10 +9,13 @@ mkdir -p tmp/use-maven-repository-from-gradle && cd tmp/use-maven-repository-fro
|
||||||
# test the maven repository from gradle.
|
# test the maven repository from gradle.
|
||||||
|
|
||||||
# download and install gradle.
|
# download and install gradle.
|
||||||
apt-get install -y unzip
|
gradle_version='6.8.3'
|
||||||
wget -qO/tmp/gradle-4.2.1-bin.zip https://services.gradle.org/distributions/gradle-4.2.1-bin.zip
|
if [ ! -f /opt/gradle/gradle-$gradle_version/bin/gradle ]; then
|
||||||
unzip -d /opt/gradle /tmp/gradle-4.2.1-bin.zip
|
apt-get install -y unzip
|
||||||
export PATH="$PATH:/opt/gradle/gradle-4.2.1/bin"
|
wget -qO/tmp/gradle-$gradle_version-bin.zip https://services.gradle.org/distributions/gradle-$gradle_version-bin.zip
|
||||||
|
unzip -d /opt/gradle /tmp/gradle-$gradle_version-bin.zip
|
||||||
|
fi
|
||||||
|
export PATH="$PATH:/opt/gradle/gradle-$gradle_version/bin"
|
||||||
|
|
||||||
# build and upload an example library.
|
# build and upload an example library.
|
||||||
mkdir gradle-greeter-library
|
mkdir gradle-greeter-library
|
||||||
|
|
@ -29,13 +32,17 @@ cat >settings.gradle <<'EOF'
|
||||||
rootProject.name = 'gradle-greeter'
|
rootProject.name = 'gradle-greeter'
|
||||||
EOF
|
EOF
|
||||||
cat >build.gradle <<'EOF'
|
cat >build.gradle <<'EOF'
|
||||||
// see https://docs.gradle.org/4.2.1/userguide/java_library_plugin.html
|
// see https://docs.gradle.org/6.8.3/userguide/java_library_plugin.html
|
||||||
// see https://docs.gradle.org/4.2.1/userguide/maven_plugin.html
|
// see https://docs.gradle.org/6.8.3/userguide/maven_plugin.html
|
||||||
|
|
||||||
apply plugin: 'java-library'
|
plugins {
|
||||||
apply plugin: 'maven'
|
id 'java-library'
|
||||||
|
id 'maven-publish'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'com.example'
|
||||||
version = '1.0.0'
|
version = '1.0.0'
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
targetCompatibility = 1.8
|
targetCompatibility = 1.8
|
||||||
|
|
||||||
|
|
@ -43,30 +50,36 @@ jar {
|
||||||
manifest {
|
manifest {
|
||||||
attributes(
|
attributes(
|
||||||
'Implementation-Title': 'Gradle Greeter Example',
|
'Implementation-Title': 'Gradle Greeter Example',
|
||||||
'Implementation-Version': version
|
'Implementation-Version': project.version
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadArchives {
|
publishing {
|
||||||
|
publications {
|
||||||
|
maven(MavenPublication) {
|
||||||
|
from components.java
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenDeployer {
|
maven {
|
||||||
repository(url: System.env.NEXUS_REPOSITORY_URL) {
|
url System.env.NEXUS_REPOSITORY_URL
|
||||||
authentication(
|
credentials {
|
||||||
userName: System.env.NEXUS_REPOSITORY_USERNAME,
|
username = System.env.NEXUS_REPOSITORY_USERNAME
|
||||||
password: System.env.NEXUS_REPOSITORY_PASSWORD)
|
password = System.env.NEXUS_REPOSITORY_PASSWORD
|
||||||
}
|
}
|
||||||
pom.groupId = 'com.example'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
gradle build
|
gradle --warning-mode all build
|
||||||
unzip -l build/libs/gradle-greeter-1.0.0.jar
|
unzip -l build/libs/gradle-greeter-1.0.0.jar
|
||||||
|
unzip -p build/libs/gradle-greeter-1.0.0.jar META-INF/MANIFEST.MF
|
||||||
export NEXUS_REPOSITORY_URL="https://$nexus_domain/repository/maven-releases"
|
export NEXUS_REPOSITORY_URL="https://$nexus_domain/repository/maven-releases"
|
||||||
export NEXUS_REPOSITORY_USERNAME='alice.doe'
|
export NEXUS_REPOSITORY_USERNAME='alice.doe'
|
||||||
export NEXUS_REPOSITORY_PASSWORD='password'
|
export NEXUS_REPOSITORY_PASSWORD='password'
|
||||||
gradle upload
|
gradle --warning-mode all publish
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# build an example application that uses our gradle-greeter library from our nexus repository.
|
# build an example application that uses our gradle-greeter library from our nexus repository.
|
||||||
|
|
@ -84,18 +97,24 @@ cat >settings.gradle <<'EOF'
|
||||||
rootProject.name = 'gradle-greeter-application'
|
rootProject.name = 'gradle-greeter-application'
|
||||||
EOF
|
EOF
|
||||||
cat >build.gradle <<EOF
|
cat >build.gradle <<EOF
|
||||||
// see https://docs.gradle.org/4.2.1/userguide/java_plugin.html
|
// see https://docs.gradle.org/6.8.3/userguide/java_plugin.html
|
||||||
// see https://docs.gradle.org/4.2.1/userguide/application_plugin.html
|
// see https://docs.gradle.org/6.8.3/userguide/application_plugin.html
|
||||||
// see http://imperceptiblethoughts.com/shadow/
|
// see http://imperceptiblethoughts.com/shadow/
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.github.johnrengelman.shadow' version '2.0.1'
|
id 'application'
|
||||||
|
id 'com.github.johnrengelman.shadow' version '6.1.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'application'
|
group = 'com.example'
|
||||||
|
version = '1.0.0'
|
||||||
|
|
||||||
mainClassName = 'Greet'
|
mainClassName = 'Greet'
|
||||||
version = '1.0.0'
|
|
||||||
|
application {
|
||||||
|
mainClass = project.mainClassName
|
||||||
|
}
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
targetCompatibility = 1.8
|
targetCompatibility = 1.8
|
||||||
|
|
||||||
|
|
@ -103,8 +122,7 @@ jar {
|
||||||
manifest {
|
manifest {
|
||||||
attributes(
|
attributes(
|
||||||
'Implementation-Title': 'Gradle Greeter Application Example',
|
'Implementation-Title': 'Gradle Greeter Application Example',
|
||||||
'Implementation-Version': version,
|
'Implementation-Version': project.version
|
||||||
'Main-Class': mainClassName
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -116,10 +134,11 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.example:gradle-greeter:1.0.0'
|
implementation 'com.example:gradle-greeter:1.0.0'
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
gradle shadowJar
|
gradle --warning-mode all shadowJar
|
||||||
unzip -l build/libs/gradle-greeter-application-1.0.0-all.jar
|
unzip -l build/libs/gradle-greeter-application-1.0.0-all.jar
|
||||||
|
unzip -p build/libs/gradle-greeter-application-1.0.0-all.jar META-INF/MANIFEST.MF
|
||||||
java -jar build/libs/gradle-greeter-application-1.0.0-all.jar
|
java -jar build/libs/gradle-greeter-application-1.0.0-all.jar
|
||||||
popd
|
popd
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue