Skip to content

Commit 8181935

Browse files
committed
add ability to version the project and builds
1 parent f8d5579 commit 8181935

File tree

4 files changed

+65
-16
lines changed

4 files changed

+65
-16
lines changed

build.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#version
2+
skyprofiler.version=1.0.1
3+
14
# Context path where the build files will be placed after the build
25
skyprofiler.target.dir=dist
36

build.xml

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,26 @@
8686
<echo message="Cleaning completed for SKY Profiler runtime and server." />
8787
</target>
8888

89+
<!-- update pom version based on the build property version -->
90+
<target name="server.version" description="Update the versions on the maven submodules" depends="init.maven">
91+
<artifact:mvn pom="${skyprofiler.server.dir}/pom.xml" mavenHome="${mvn_home}" fork="true" failonerror="true">
92+
<jvmarg value="-Dmaven.multiModuleProjectDirectory" />
93+
<jvmarg value="-DnewVersion=${skyprofiler.version}" />
94+
<arg value="versions:set" />
95+
</artifact:mvn>
96+
</target>
97+
98+
<!-- update pom version based on the build property version -->
99+
<target name="runtime.version" description="Update the versions on the maven submodules" depends="init.maven">
100+
<artifact:mvn pom="${skyprofiler.runtime.dir}/pom.xml" mavenHome="${mvn_home}" fork="true" failonerror="true">
101+
<jvmarg value="-Dmaven.multiModuleProjectDirectory" />
102+
<jvmarg value="-DnewVersion=${skyprofiler.version}" />
103+
<arg value="versions:set" />
104+
</artifact:mvn>
105+
</target>
106+
89107
<!-- Compile and build SKY Profiler runtime -->
90-
<target name="runtime.jar" description="Compiles the sources and creates SKY Profiler runtime jar" depends="runtime.clean, runtime.init">
108+
<target name="runtime.jar" description="Compiles the sources and creates SKY Profiler runtime jar" depends="runtime.version, runtime.clean, runtime.init">
91109
<artifact:mvn pom="${skyprofiler.runtime.dir}/pom.xml" mavenHome="${mvn_home}" fork="true" failonerror="true">
92110
<jvmarg value="-Dmaven.multiModuleProjectDirectory" />
93111
<arg value="package" />
@@ -96,14 +114,30 @@
96114
</target>
97115

98116
<!-- Compile and build SKY Profiler server -->
99-
<target name="server.jar" description="Compiles the sources and creates SKY Profiler server jar" depends="server.clean, server.init">
117+
<target name="server.jar" description="Compiles the sources and creates SKY Profiler server jar" depends="server.version, server.clean, server.init">
100118
<artifact:mvn pom="${skyprofiler.server.dir}/pom.xml" mavenHome="${mvn_home}" fork="true" failonerror="true">
101119
<jvmarg value="-Dmaven.multiModuleProjectDirectory" />
102120
<arg value="package" />
103121
<arg value="-DskipTests" />
104122
</artifact:mvn>
105123
</target>
106124

125+
<target name="server.docker.build" description="Build the SKY Profiler docker image" depends="server.jar">
126+
<artifact:mvn pom="${skyprofiler.server.dir}/pom.xml" mavenHome="${mvn_home}" fork="true" failonerror="true">
127+
<jvmarg value="-Dmaven.multiModuleProjectDirectory" />
128+
<arg value="docker:build" />
129+
<arg value="-DskipTests" />
130+
</artifact:mvn>
131+
</target>
132+
133+
<target name="server.docker.push" description="Deploy the docker image to docker-hub" depends="server.docker.build">
134+
<artifact:mvn pom="${skyprofiler.server.dir}/pom.xml" mavenHome="${mvn_home}" fork="true" failonerror="true">
135+
<jvmarg value="-Dmaven.multiModuleProjectDirectory" />
136+
<arg value="docker:push" />
137+
<arg value="-DskipTests" />
138+
</artifact:mvn>
139+
</target>
140+
107141
<!-- Building ISPackage -->
108142
<target name="runtime.build" description="Builds runtime jar, Copy IS package files, place the jar and zip them together to create IS package" depends="runtime.jar">
109143
<copy todir="${skyprofiler.target.dir}">
@@ -136,11 +170,11 @@
136170
<get src="http://central.maven.org/maven2/net/java/dev/jna/jna-platform/4.4.0/jna-platform-4.4.0.jar"
137171
dest="${skyprofiler.target.dir}/SKYProfiler/code/jars/jna-platform-4.4.0.jar" usetimestamp="true" />
138172

139-
<copy tofile="${skyprofiler.target.dir}/SKYProfiler/code/jars/skyprofiler.jar">
173+
<copy tofile="${skyprofiler.target.dir}/SKYProfiler/code/jars/skyprofiler-${skyprofiler.version}.jar">
140174
<fileset file="${skyprofiler.runtime.dir}/target/*.jar" />
141175
</copy>
142176

143-
<zip destfile="${skyprofiler.target.dir}/SKYProfiler.zip">
177+
<zip destfile="${skyprofiler.target.dir}/SKYProfiler-${skyprofiler.version}.zip">
144178
<zipfileset dir="${skyprofiler.target.dir}/SKYProfiler" />
145179
</zip>
146180

source/ISPackage/SKYProfilerRuntime/pom.xml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
32
<modelVersion>4.0.0</modelVersion>
43
<groupId>com.softwareag.skyprofilerruntime</groupId>
54
<artifactId>skyprofilerruntime</artifactId>
6-
<version>1.0.0-RELEASE</version>
5+
<version>1.0.2</version>
76
<build>
87
<sourceDirectory>src</sourceDirectory>
98
<plugins>
@@ -15,7 +14,12 @@
1514
<target>1.8</target>
1615
</configuration>
1716
</plugin>
18-
<plugin>
17+
<plugin>
18+
<groupId>org.apache.maven.plugins</groupId>
19+
<artifactId>maven-release-plugin</artifactId>
20+
<version>2.5.3</version>
21+
</plugin>
22+
<plugin>
1923
<groupId>org.apache.maven.plugins</groupId>
2024
<artifactId>maven-install-plugin</artifactId>
2125
<version>2.5.2</version>
@@ -81,7 +85,7 @@
8185
</goals>
8286
</pluginExecutionFilter>
8387
<action>
84-
<ignore></ignore>
88+
<ignore />
8589
</action>
8690
</pluginExecution>
8791
</pluginExecutions>

source/SKYProfilerServer/pom.xml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
43
<modelVersion>4.0.0</modelVersion>
54

65
<groupId>com.softwareag.skyprofiler</groupId>
76
<artifactId>webmethods-skyprofiler</artifactId>
8-
<version>1.0-RELEASE</version>
7+
<version>1.0.2</version>
98
<packaging>jar</packaging>
109

1110
<name>SKY Profiler</name>
@@ -111,25 +110,35 @@
111110
<groupId>org.springframework.boot</groupId>
112111
<artifactId>spring-boot-maven-plugin</artifactId>
113112
</plugin>
113+
<plugin>
114+
<groupId>org.apache.maven.plugins</groupId>
115+
<artifactId>maven-release-plugin</artifactId>
116+
<version>2.5.3</version>
117+
</plugin>
114118
<plugin>
115119
<groupId>com.spotify</groupId>
116120
<artifactId>docker-maven-plugin</artifactId>
117121
<version>0.4.14</version>
118122
<configuration>
119-
<imageName>${docker.images.prefix}/${project.artifactId}:${project.version}</imageName>
123+
<imageName>${docker.images.prefix}/${project.artifactId}</imageName>
124+
<newName>${docker.images.repo}/${docker.images.prefix}/${project.artifactId}</newName>
120125
<dockerDirectory>${project.basedir}</dockerDirectory>
126+
<forceTags>true</forceTags>
127+
<serverId>docker-hub</serverId>
128+
<imageTags>
129+
<imageTag>${project.version}</imageTag>
130+
<imageTag>latest</imageTag>
131+
</imageTags>
121132
</configuration>
122133
<executions>
123134
<execution>
124135
<id>build-image</id>
125-
<phase>package</phase>
126136
<goals>
127137
<goal>build</goal>
128138
</goals>
129139
</execution>
130140
<execution>
131141
<id>tag-image-version</id>
132-
<phase>install</phase>
133142
<goals>
134143
<goal>tag</goal>
135144
</goals>
@@ -142,7 +151,6 @@
142151
</execution>
143152
<execution>
144153
<id>tag-image-latest</id>
145-
<phase>install</phase>
146154
<goals>
147155
<goal>tag</goal>
148156
</goals>

0 commit comments

Comments
 (0)