Skip to content

Commit ed98b0b

Browse files
authored
2.3.9 new artifact "devstack-standalone" (#29)
* Experimenting with separate pom file for standalone * publish-maven-package.yml createStandalonePom.groovy shadingConf.xml * Improved workflow to build two separate artifacts devstack and devstack-standalone * Using the same artifact name but two classifiers ended up breaking the projects pom when importing in third party projects pom.xml * Bumped to 2.3.9 * Added steps to generate pom-standalone.xml * Updated README.md
1 parent 5e59e0e commit ed98b0b

File tree

5 files changed

+129
-81
lines changed

5 files changed

+129
-81
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Creates a new pom-standalone.xml based on pom.xml but with new artifact name (devstack-standalone) and
3+
* additional build steps for shading based on shadingConf.xml
4+
*/
5+
String projectBasePath = project.basedir
6+
File origPom = new File(projectBasePath + "/pom.xml")
7+
File shadingConf = new File(projectBasePath + "/.github/buildScripts/shadingConf.xml")
8+
9+
String newPomBody = origPom.text.replace("<plugins>", "<plugins>\n" + shadingConf.text)
10+
11+
newPomBody = newPomBody.replaceFirst("<artifactId>devstack<\\/artifactId>", "<artifactId>devstack-standalone<\\/artifactId>")
12+
13+
File standalonePom = new File(projectBasePath + "/pom-standalone.xml")
14+
standalonePom.createNewFile()
15+
standalonePom.text = newPomBody
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<plugin>
2+
<!-- Configured in pluginManagement instead of plugins, because we do not want a shaded parent POM -->
3+
<groupId>org.apache.maven.plugins</groupId>
4+
<artifactId>maven-shade-plugin</artifactId>
5+
<version>3.5.0</version>
6+
<executions>
7+
<execution>
8+
<phase>package</phase>
9+
<goals>
10+
<goal>shade</goal>
11+
</goals>
12+
<configuration>
13+
<!-- Will output 2 jars: the original, and the shaded one -->
14+
<shadedArtifactAttached>false</shadedArtifactAttached>
15+
16+
<!-- final name of the shaded jar will be ${project.artifactId}-standalone -->
17+
<!--shadedClassifierName>standalone</shadedClassifierName-->
18+
19+
<filters>
20+
<filter>
21+
<artifact>*:*</artifact>
22+
<excludes>
23+
<exclude>META-INF/*.SF</exclude>
24+
<exclude>META-INF/*.DSA</exclude>
25+
<exclude>META-INF/*.RSA</exclude>
26+
<exclude>META-INF/*.MF</exclude>
27+
</excludes>
28+
</filter>
29+
</filters>
30+
31+
<artifactSet>
32+
<excludes>
33+
<exclude>org.codehaus.groovy:*</exclude>
34+
<!--exclude>org.codehaus.groovy:groovy</exclude>
35+
<exclude>org.codehaus.groovy:groovy-astbuilder</exclude-->
36+
<exclude>com.google.code.gson:gson</exclude>
37+
<exclude>org.apache.httpcomponents</exclude>
38+
<!--exclude>commons-*</exclude--> <!--Seems to break JenkinsAndHarborDeployment.groovy:103, needs org/apache/commons/io/FileUtils-->
39+
<exclude>com.kohlschutter.junixsocket:junixsocket-core</exclude>
40+
</excludes>
41+
42+
</artifactSet>
43+
<relocations>
44+
<relocation>
45+
<pattern>com.eficode.atlassian</pattern>
46+
<shadedPattern>com.eficode.shaded.atlassian</shadedPattern>
47+
</relocation>
48+
<relocation>
49+
<pattern>okio</pattern>
50+
<shadedPattern>com.eficode.shaded.okio</shadedPattern>
51+
</relocation>
52+
<relocation>
53+
<pattern>okhttp3</pattern>
54+
<shadedPattern>com.eficode.shaded.okhttp3</shadedPattern>
55+
</relocation>
56+
</relocations>
57+
58+
<!-- NOTE: Any dependencies of the project will not show up in the standalone pom.
59+
This means that if those dependencies are not properly relocated and there is a class-loading conflict,
60+
user would not be able to figure out where the conflicting dependency is. -->
61+
<createDependencyReducedPom>true</createDependencyReducedPom>
62+
63+
<createSourcesJar>true</createSourcesJar>
64+
</configuration>
65+
</execution>
66+
</executions>
67+
</plugin>

.github/workflows/publish-maven-package.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,21 @@ jobs:
4040
run: |
4141
4242
mkdir -p repository/com/eficode/devstack
43+
mkdir -p repository/com/eficode/devstack-standalone
4344
44-
mvn help:effective-pom -P groovy-3 -Doutput=effective-pom.xml
45-
mvn install -f effective-pom.xml -DcreateChecksum=true
45+
echo Building and installing "normal" version
46+
mvn install -f pom.xml -DcreateChecksum=true
47+
48+
echo Creating pom for standalone version and installing
49+
mvn gplus:execute@execute
50+
mvn install -f pom-standalone.xml -DcreateChecksum=true
4651
4752
4853
- name: Copying JAR files
4954
run: |
5055
echo Copying the new JAR files to repository which will be added to git branch "packages"
5156
rsync -avh --checksum ~/.m2/repository/com/eficode/devstack/ repository/com/eficode/devstack/
57+
rsync -avh --checksum ~/.m2/repository/com/eficode/devstack-standalone/ repository/com/eficode/devstack-standalone/
5258
5359
- name: Committing and pushing JAR files
5460
run: |

README.md

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ SubDeployments are simply a collection of deployments used by a more complex dep
3838

3939
## Utils
4040

41-
These are classes mainly intended to be used by Container/Deployment-classes when massaging of the containers are needed for example. Currently [ImageBuilder.groovy](src%2Fmain%2Fgroovy%2Fcom%2Feficode%2Fdevstack%2Futil%2FImageBuilder.groovy) dynamically builds Atlassian images for non x86 architectures on the fly.
41+
These are classes mainly intended to be used by Container/Deployment-classes when massaging of the containers are needed for example.
42+
Currently, [ImageBuilder.groovy](src%2Fmain%2Fgroovy%2Fcom%2Feficode%2Fdevstack%2Futil%2FImageBuilder.groovy) dynamically builds Atlassian images for non x86 architectures on the fly.
43+
[TimeMachine.groovy](src%2Fmain%2Fgroovy%2Fcom%2Feficode%2Fdevstack%2Futil%2FTimeMachine.groovy) changes the apparent time for all
44+
containers sharing a Docker Engine, intended for testing date changes.
4245

4346
# Setup Docker Engine in AWS
4447

@@ -90,15 +93,15 @@ JsmH2Deployment jsmDep = new JsmH2Deployment(jiraBaseUrl, dockerRemoteHost, dock
9093

9194
## Using DevStack in your project
9295

93-
A note on versions, DevStack is cross-compiled for both Groovy 3 and 2.5, these editions are also available in a standalone edition with shaded dependencies.
96+
A note on versions, DevStack is available in two version a "normal" one and a standalone edition with shaded dependencies.
9497

9598
The standalone edition should alleviate dependency issues but is also larger
9699

97100
Examples:
98-
* com.eficode:devstack:2.0.0-SNAPSHOT-groovy-2.5
99-
* DevStack version 2.0.0, compiled for groovy 2.5
100-
* devstack:2.0.0-SNAPSHOT-groovy-3.0:jar:standalone
101-
* DevStack version 2.0.0, compiled for groovy 3, standalone edition.
101+
* com.eficode:devstack:2.3.9-SNAPSHOT
102+
* DevStack version 2.3.9-SNAPSHOT
103+
* com.eficode:devstack-standalone:2.3.9-SNAPSHOT
104+
* DevStack version 2.3.9-SNAPSHOT, standalone edition.
102105

103106
To find the latest version, check the "packages" branch: https://github.com/eficode/devStack/tree/packages/repository/com/eficode/devstack
104107

@@ -107,10 +110,10 @@ To find the latest version, check the "packages" branch: https://github.com/efic
107110

108111
```bash
109112

110-
mvn dependency:get -Dartifact=com.eficode:devstack:2.0.0-SNAPSHOT-groovy-2.5 -DremoteRepositories=https://github.com/eficode/DevStack/raw/packages/repository/
113+
mvn dependency:get -Dartifact=com.eficode:devstack:2.3.9-SNAPSHOT -DremoteRepositories=https://github.com/eficode/DevStack/raw/packages/repository/
111114

112115

113-
mvn dependency:get -Dartifact=com.eficode:devstack:2.0.0-SNAPSHOT-groovy-2.5:jar:standalone -DremoteRepositories=https://github.com/eficode/DevStack/raw/packages/repository/
116+
mvn dependency:get -Dartifact=com.eficode:devstack-standalone:2.3.9-SNAPSHOT -DremoteRepositories=https://github.com/eficode/DevStack/raw/packages/repository/
114117

115118
```
116119

@@ -124,9 +127,9 @@ mvn dependency:get -Dartifact=com.eficode:devstack:2.0.0-SNAPSHOT-groovy-2.5:jar
124127
<dependency>
125128
<groupId>com.eficode</groupId>
126129
<artifactId>devstack</artifactId>
127-
<version>2.0.0-SNAPSHOT-groovy-3.0</version>
128-
<!--Optional standalone classifier-->
129-
<!--classifier>standalone</classifier-->
130+
<version>2.3.9-SNAPSHOT</version>
131+
<!--Optional standalone version-->
132+
<!--artifactId>devstack-standalone</artifactId-->
130133
</dependency>
131134
</dependencies>
132135

@@ -140,4 +143,16 @@ mvn dependency:get -Dartifact=com.eficode:devstack:2.0.0-SNAPSHOT-groovy-2.5:jar
140143
</repositories>
141144
..
142145
....
143-
```
146+
```
147+
148+
### Grape Dependency
149+
```groovy
150+
@GrabResolver(name = "devstack-github", root = "https://github.com/eficode/devstack/raw/packages/repository/")
151+
@Grab(group = "com.eficode" , module = "devstack-standalone", version = "2.3.9-SNAPSHOT")
152+
```
153+
154+
155+
# Breaking Changes
156+
157+
* 2.3.9
158+
* From now on two artifacts will be generated, devstack and devstack-standalone and the classifier standalone is deprecated

pom.xml

Lines changed: 12 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.eficode</groupId>
88
<artifactId>devstack</artifactId>
9-
<version>2.3.8-SNAPSHOT</version>
9+
<version>2.3.9-SNAPSHOT</version>
1010
<packaging>jar</packaging>
1111

1212
<name>DevStack</name>
@@ -161,73 +161,7 @@
161161
<build>
162162
<!--sourceDirectory>${basedir}/src/main/groovy/</sourceDirectory-->
163163
<plugins>
164-
<plugin>
165-
<!-- Configured in pluginManagement instead of plugins, because we do not want a shaded parent POM -->
166-
<groupId>org.apache.maven.plugins</groupId>
167-
<artifactId>maven-shade-plugin</artifactId>
168-
<version>3.5.0</version>
169-
<executions>
170-
<execution>
171-
<phase>package</phase>
172-
<goals>
173-
<goal>shade</goal>
174-
</goals>
175-
<configuration>
176-
<!-- Will output 2 jars: the original, and the shaded one -->
177-
<shadedArtifactAttached>true</shadedArtifactAttached>
178-
179-
<!-- final name of the shaded jar will be ${project.artifactId}-standalone -->
180-
<shadedClassifierName>standalone</shadedClassifierName>
181-
182-
<filters>
183-
<filter>
184-
<artifact>*:*</artifact>
185-
<excludes>
186-
<exclude>META-INF/*.SF</exclude>
187-
<exclude>META-INF/*.DSA</exclude>
188-
<exclude>META-INF/*.RSA</exclude>
189-
<exclude>META-INF/*.MF</exclude>
190-
</excludes>
191-
</filter>
192-
</filters>
193-
194-
<artifactSet>
195-
<excludes>
196-
<exclude>org.codehaus.groovy:*</exclude>
197-
<!--exclude>org.codehaus.groovy:groovy</exclude>
198-
<exclude>org.codehaus.groovy:groovy-astbuilder</exclude-->
199-
<exclude>com.google.code.gson:gson</exclude>
200-
<exclude>org.apache.httpcomponents</exclude>
201-
<!--exclude>commons-*</exclude--> <!--Seems to break JenkinsAndHarborDeployment.groovy:103, needs org/apache/commons/io/FileUtils-->
202-
<exclude>com.kohlschutter.junixsocket:junixsocket-core</exclude>
203-
</excludes>
204-
205-
</artifactSet>
206-
<relocations>
207-
<relocation>
208-
<pattern>com.eficode.atlassian</pattern>
209-
<shadedPattern>com.eficode.shaded.atlassian</shadedPattern>
210-
</relocation>
211-
<relocation>
212-
<pattern>okio</pattern>
213-
<shadedPattern>com.eficode.shaded.okio</shadedPattern>
214-
</relocation>
215-
<relocation>
216-
<pattern>okhttp3</pattern>
217-
<shadedPattern>com.eficode.shaded.okhttp3</shadedPattern>
218-
</relocation>
219-
</relocations>
220164

221-
<!-- NOTE: Any dependencies of the project will not show up in the standalone pom.
222-
This means that if those dependencies are not properly relocated and there is a class-loading conflict,
223-
user would not be able to figure out where the conflicting dependency is. -->
224-
<createDependencyReducedPom>false</createDependencyReducedPom>
225-
226-
<createSourcesJar>true</createSourcesJar>
227-
</configuration>
228-
</execution>
229-
</executions>
230-
</plugin>
231165
<plugin>
232166
<groupId>org.apache.maven.plugins</groupId>
233167
<artifactId>maven-source-plugin</artifactId>
@@ -256,6 +190,12 @@
256190
<goal>compileTests</goal>
257191
</goals>
258192
</execution>
193+
<execution>
194+
<id>execute</id>
195+
<goals>
196+
<goal>execute</goal>
197+
</goals>
198+
</execution>
259199
</executions>
260200
<dependencies>
261201
<dependency>
@@ -265,6 +205,11 @@
265205
<scope>runtime</scope>
266206
</dependency>
267207
</dependencies>
208+
<configuration>
209+
<scripts>
210+
<script>${project.basedir}/.github/buildScripts/createStandalonePom.groovy</script>
211+
</scripts>
212+
</configuration>
268213
</plugin>
269214
<plugin>
270215
<groupId>org.apache.maven.plugins</groupId>

0 commit comments

Comments
 (0)