Skip to content

Commit e98b64a

Browse files
author
Gerhard Dickescheid
committed
enhancement: project name and version are read from project.properties resource, prepare maven central deployment
1 parent 76430a3 commit e98b64a

File tree

10 files changed

+250
-76
lines changed

10 files changed

+250
-76
lines changed

build.gradle

Lines changed: 101 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,31 @@
66
*
77
*/
88

9+
910
group 'de.eacg'
10-
version '0.1.1-SNAPSHOT'
11+
version '0.1.1'
1112

1213
buildscript {
1314
dependencies {
14-
classpath 'de.eacg:ecs-gradle-plugin:0.1.1-SNAPSHOT'
15-
15+
// classpath 'de.eacg:ecs-gradle-plugin:0.1.1-SNAPSHOT'
16+
classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.5.3'
1617
}
1718
repositories {
1819
mavenLocal()
20+
mavenCentral()
1921
}
2022
}
2123

2224
apply plugin: 'groovy'
2325
apply plugin: 'maven'
24-
apply plugin: 'de.eacg.ecs.plugin.gradle'
26+
apply plugin: 'signing'
27+
apply plugin: 'io.codearte.nexus-staging'
28+
29+
Jar Files
30+
//apply plugin: 'de.eacg.ecs.plugin.gradle'
2531

26-
sourceCompatibility = 1.6
27-
targetCompatibility = 1.6
32+
sourceCompatibility = JavaVersion.VERSION_1_7
33+
targetCompatibility = JavaVersion.VERSION_1_7
2834

2935
repositories {
3036
mavenLocal()
@@ -39,17 +45,100 @@ uploadArchives {
3945
}
4046
}
4147

48+
processResources {
49+
expand(project.properties)
50+
}
51+
52+
nexusStaging {
53+
// packageGroup = "org.mycompany.myproject" //optional if packageGroup == project.getGroup()
54+
stagingProfileId = "3214c3fab3cb2b" //when not defined will be got from server using "packageGroup"
55+
}
56+
57+
4258
dependencies {
4359
compile gradleApi()
4460
compile localGroovy()
4561
compile 'de.eacg:ecs-java-client:0.1.0-SNAPSHOT'
4662
testCompile 'junit:junit:4.12'
4763
}
4864

49-
ecsPlugin{
50-
configuration 'runtime'
51-
credentials = '~/.ecsrc.json'
65+
//ecsPlugin {
66+
// configuration 'runtime'
67+
// credentials = '~/.ecsrc.json'
68+
//
69+
// skipTransfer = false
70+
// baseUrl = "http://localhost:3000"
71+
//}
72+
73+
74+
task wrapper(type: Wrapper) {
75+
gradleVersion = '2.11'
76+
}
77+
78+
task javadocJar(type: Jar) {
79+
classifier = 'javadoc'
80+
from javadoc
81+
}
82+
83+
task sourcesJar(type: Jar) {
84+
classifier = 'sources'
85+
from sourceSets.main.allSource
86+
}
87+
88+
artifacts {
89+
archives javadocJar, sourcesJar
90+
}
91+
92+
signing {
93+
sign configurations.archives
94+
}
95+
96+
archivesBaseName = 'ecs-gradle-plugin'
97+
uploadArchives {
98+
repositories {
99+
mavenDeployer {
100+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
101+
102+
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
103+
authentication(userName: ossrhUsername, password: ossrhPassword)
104+
}
105+
106+
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
107+
authentication(userName: ossrhUsername, password: ossrhPassword)
108+
}
109+
110+
pom.project {
111+
name 'ECS gradle plugin'
112+
packaging 'jar'
113+
// optionally artifactId can be defined here
114+
description 'EACG Code Scan gradle plugin. A gradle plugin to transfer dependency information to ECS server.'
115+
116+
url 'https://github.com/eacg-gmbh/ecs-gradle-plugin'
117+
118+
scm {
119+
url 'https://github.com/eacg-gmbh/ecs-gradle-plugin'
120+
}
121+
122+
licenses {
123+
license {
124+
name 'MIT'
125+
url 'https://raw.githubusercontent.com/eacg-gmbh/ecs-gradle-plugin/master/LICENSE'
126+
distribution 'repo'
127+
}
128+
}
129+
130+
developers {
131+
developer {
132+
id 'gdd'
133+
name 'Gerhard Dickescheid'
134+
email 'gdd@eacg.de'
135+
organization 'EACG, Enterprise Architecture Consulting Group GmbH'
136+
organizationUrl 'https://www.eacg.de/'
137+
}
138+
}
139+
}
140+
}
141+
}
142+
}
143+
52144

53-
skipTransfer = false
54-
baseUrl = "http://localhost:3000"
55-
}

gradle/wrapper/gradle-wrapper.jar

1.33 KB
Binary file not shown.
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
1-
#
2-
#
3-
# Copyright (c) 2016. Enterprise Architecture Group, EACG
4-
#
5-
# SPDX-License-Identifier: MIT
6-
#
7-
#
8-
9-
#Tue Jan 05 19:45:07 CET 2016
1+
#Fri Feb 12 13:25:02 CET 2016
102
distributionBase=GRADLE_USER_HOME
113
distributionPath=wrapper/dists
124
zipStoreBase=GRADLE_USER_HOME
135
zipStorePath=wrapper/dists
14-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-bin.zip

gradlew

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ case "`uname`" in
4242
;;
4343
esac
4444

45-
# For Cygwin, ensure paths are in UNIX format before anything is touched.
46-
if $cygwin ; then
47-
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48-
fi
49-
5045
# Attempt to set APP_HOME
5146
# Resolve links: $0 may be a link
5247
PRG="$0"
@@ -61,9 +56,9 @@ while [ -h "$PRG" ] ; do
6156
fi
6257
done
6358
SAVED="`pwd`"
64-
cd "`dirname \"$PRG\"`/" >&-
59+
cd "`dirname \"$PRG\"`/" >/dev/null
6560
APP_HOME="`pwd -P`"
66-
cd "$SAVED" >&-
61+
cd "$SAVED" >/dev/null
6762

6863
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
6964

@@ -114,6 +109,7 @@ fi
114109
if $cygwin ; then
115110
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116111
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112+
JAVACMD=`cygpath --unix "$JAVACMD"`
117113

118114
# We build the pattern for arguments to be converted via cygpath
119115
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`

src/main/groovy/de/eacg/ecs/gradle/plugin/EcsPlugin.groovy

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -17,43 +17,9 @@ class EcsPlugin implements Plugin<Project> {
1717
project.ecsPlugin.projectName = project.name
1818
project.ecsPlugin.moduleName = project.name
1919
project.ecsPlugin.moduleId = project.group + ':' + project.name
20-
project.task('scan', type: ScanTask)
20+
project.task('dependency-scan', type: ScanTask)
2121
}
2222
}
2323

2424

25-
// Extension according to
26-
// https://docs.gradle.org/current/userguide/custom_plugins.html
27-
// Chapter 39.3. Getting input from the build
28-
class EcsPluginExtension {
29-
def configurations = []
30-
31-
String baseUrl = 'https://ecs-app.eacg.de'
32-
String apiPath = '/api/v1'
33-
34-
String projectName
35-
String moduleName
36-
String moduleId
37-
38-
String credentials
39-
String userName
40-
String apiKey
41-
42-
Boolean skip = false
43-
Boolean skipTransfer = false
44-
45-
void configuration(String... confs) {
46-
for(String s in confs) {
47-
configurations << s
48-
}
49-
}
50-
51-
def getConfigurations() {
52-
if(this.configurations.isEmpty()) {
53-
this.configurations << 'default'
54-
}
55-
return this.configurations as Set
56-
}
57-
}
58-
5925

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
*
3+
* Copyright (c) 2016. Enterprise Architecture Group, EACG
4+
*
5+
* SPDX-License-Identifier: MIT
6+
*
7+
*/
8+
9+
package de.eacg.ecs.gradle.plugin
10+
11+
// Extension according to
12+
// https://docs.gradle.org/current/userguide/custom_plugins.html
13+
// Chapter 39.3. Getting input from the build
14+
class EcsPluginExtension {
15+
def configurations = []
16+
17+
String baseUrl = 'https://ecs-app.eacg.de'
18+
String apiPath = '/api/v1'
19+
20+
String projectName
21+
String moduleName
22+
String moduleId
23+
24+
String credentials
25+
String userName
26+
String apiKey
27+
28+
Boolean skip = false
29+
Boolean skipTransfer = false
30+
Boolean verbose = false
31+
32+
void configuration(String... confs) {
33+
for (String s in confs) {
34+
configurations << s
35+
}
36+
}
37+
38+
def getConfigurations() {
39+
if (this.configurations.isEmpty()) {
40+
this.configurations << 'default'
41+
}
42+
return this.configurations as Set
43+
}
44+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
*
3+
* Copyright (c) 2016. Enterprise Architecture Group, EACG
4+
*
5+
* SPDX-License-Identifier: MIT
6+
*
7+
*/
8+
9+
package de.eacg.ecs.gradle.plugin;
10+
11+
import java.io.IOException;
12+
import java.util.Properties;
13+
14+
public class ProjectProperties extends Properties {
15+
16+
public ProjectProperties() throws IOException {
17+
super.load(this.getClass().getResourceAsStream("/project.properties"));
18+
}
19+
20+
public String getName() {
21+
return this.getProperty("artifactId");
22+
}
23+
24+
public String getVersion() {
25+
return this.getProperty("version");
26+
}
27+
}

0 commit comments

Comments
 (0)