Skip to content

Commit f8924cd

Browse files
build: Add maven-antrun-plugin (#1864)
* build: Add maven-antrun-plugin Signed-off-by: unknowIfGuestInDream <liang.tang.cx@gmail.com> * build: Add maven-antrun-plugin Signed-off-by: unknowIfGuestInDream <liang.tang.cx@gmail.com> * build: Add maven-antrun-plugin Signed-off-by: unknowIfGuestInDream <liang.tang.cx@gmail.com> * build: Add maven-antrun-plugin Signed-off-by: unknowIfGuestInDream <liang.tang.cx@gmail.com> * build: Add maven-antrun-plugin Signed-off-by: unknowIfGuestInDream <liang.tang.cx@gmail.com> --------- Signed-off-by: unknowIfGuestInDream <liang.tang.cx@gmail.com>
1 parent f4c995f commit f8924cd

File tree

2 files changed

+119
-13
lines changed

2 files changed

+119
-13
lines changed

Jenkinsfile

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
/*
2+
* Copyright (c) 2024 unknowIfGuestInDream.
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
* * Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* * Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
* * Neither the name of unknowIfGuestInDream, any associated website, nor the
13+
* names of its contributors may be used to endorse or promote products
14+
* derived from this software without specific prior written permission.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
* DISCLAIMED. IN NO EVENT SHALL UNKNOWIFGUESTINDREAM BE LIABLE FOR ANY
20+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
*/
27+
128
pipeline {
229
agent any
330
options {
@@ -59,14 +86,14 @@ pipeline {
5986
stage('Prepare Windows Build') {
6087
steps {
6188
timeout(time: 10, unit: 'MINUTES') {
62-
sh "$M2_HOME/bin/mvn -f pom.xml -s $M2_HOME/conf/settings.xml '-Djavafx.platform=win' '-Dmaven.test.skip=true' '-Dmaven.javadoc.skip=true' clean -T 1C install"
89+
sh "$M2_HOME/bin/mvn -f pom.xml -s $M2_HOME/conf/settings.xml '-Djavafx.platform=win' '-Dmaven.test.skip=true' '-Dmaven.javadoc.skip=true' -DworkEnv=ci clean -T 1C install"
6390
}
6491
}
6592
}
6693

6794
stage('Build smc-windows') {
6895
steps {
69-
sh "$M2_HOME/bin/mvn -f smc/pom.xml -s $M2_HOME/conf/settings.xml -Duser.name=${USER_NAME} -Djavafx.platform=win -Dmaven.test.skip=true -Pjavadoc-with-links package"
96+
sh "$M2_HOME/bin/mvn -f smc/pom.xml -s $M2_HOME/conf/settings.xml -Duser.name=${USER_NAME} -Djavafx.platform=win -Dmaven.test.skip=true -DworkEnv=ci -Pjavadoc-with-links package"
7097
sh '''cp smc/target/javafxTool-smc.jar javafxTool-smc.jar
7198
cp -r smc/target/lib lib
7299
cp -r smc/target/reports/apidocs apidocs
@@ -94,7 +121,7 @@ rm -r license'''
94121

95122
stage('Build qe-windows') {
96123
steps {
97-
sh "$M2_HOME/bin/mvn -f qe/pom.xml -s $M2_HOME/conf/settings.xml -Duser.name=${USER_NAME} -Djavafx.platform=win -Dmaven.test.skip=true -Pjavadoc-with-links package"
124+
sh "$M2_HOME/bin/mvn -f qe/pom.xml -s $M2_HOME/conf/settings.xml -Duser.name=${USER_NAME} -Djavafx.platform=win -Dmaven.test.skip=true -DworkEnv=ci -Pjavadoc-with-links package"
98125
sh '''cp qe/target/javafxTool-qe.jar javafxTool-qe.jar
99126
cp -r qe/target/lib lib
100127
cp -r qe/target/reports/apidocs apidocs
@@ -122,7 +149,7 @@ rm -r license'''
122149

123150
stage('Build cg-windows') {
124151
steps {
125-
sh "$M2_HOME/bin/mvn -f cg/pom.xml -s $M2_HOME/conf/settings.xml -Duser.name=${USER_NAME} -Djavafx.platform=win -Dmaven.test.skip=true -Pjavadoc-with-links package"
152+
sh "$M2_HOME/bin/mvn -f cg/pom.xml -s $M2_HOME/conf/settings.xml -Duser.name=${USER_NAME} -Djavafx.platform=win -Dmaven.test.skip=true -DworkEnv=ci -Pjavadoc-with-links package"
126153
sh '''cp cg/target/javafxTool-cg.jar javafxTool-cg.jar
127154
cp -r cg/target/lib lib
128155
cp -r cg/target/reports/apidocs apidocs
@@ -151,14 +178,14 @@ rm -r license'''
151178
stage('Prepare Mac Build') {
152179
steps {
153180
timeout(time: 10, unit: 'MINUTES') {
154-
sh "$M2_HOME/bin/mvn -f pom.xml -s $M2_HOME/conf/settings.xml -Djavafx.platform=mac -Dmaven.test.skip=true -Dmaven.javadoc.skip=true clean -T 1C install"
181+
sh "$M2_HOME/bin/mvn -f pom.xml -s $M2_HOME/conf/settings.xml -Djavafx.platform=mac -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -DworkEnv=ci clean -T 1C install"
155182
}
156183
}
157184
}
158185

159186
stage('Build smc-mac') {
160187
steps {
161-
sh "$M2_HOME/bin/mvn -f smc/pom.xml -s $M2_HOME/conf/settings.xml -Duser.name=${USER_NAME} -Djavafx.platform=mac -Dmaven.test.skip=true -Pjavadoc-with-links package"
188+
sh "$M2_HOME/bin/mvn -f smc/pom.xml -s $M2_HOME/conf/settings.xml -Duser.name=${USER_NAME} -Djavafx.platform=mac -Dmaven.test.skip=true -DworkEnv=ci -Pjavadoc-with-links package"
162189
sh '''cp smc/target/javafxTool-smc.jar javafxTool-smc.jar
163190
cp -r smc/target/lib lib
164191
cp -r smc/target/reports/apidocs apidocs
@@ -186,7 +213,7 @@ rm -r license'''
186213

187214
stage('Build qe-mac') {
188215
steps {
189-
sh "$M2_HOME/bin/mvn -f qe/pom.xml -s $M2_HOME/conf/settings.xml -Duser.name=${USER_NAME} -Djavafx.platform=mac -Dmaven.test.skip=true -Pjavadoc-with-links package"
216+
sh "$M2_HOME/bin/mvn -f qe/pom.xml -s $M2_HOME/conf/settings.xml -Duser.name=${USER_NAME} -Djavafx.platform=mac -Dmaven.test.skip=true -DworkEnv=ci -Pjavadoc-with-links package"
190217
sh '''cp qe/target/javafxTool-qe.jar javafxTool-qe.jar
191218
cp -r qe/target/lib lib
192219
cp -r qe/target/reports/apidocs apidocs
@@ -214,7 +241,7 @@ rm -r license'''
214241

215242
stage('Build cg-mac') {
216243
steps {
217-
sh "$M2_HOME/bin/mvn -f cg/pom.xml -s $M2_HOME/conf/settings.xml -Duser.name=${USER_NAME} -Djavafx.platform=mac -Dmaven.test.skip=true -Pjavadoc-with-links package"
244+
sh "$M2_HOME/bin/mvn -f cg/pom.xml -s $M2_HOME/conf/settings.xml -Duser.name=${USER_NAME} -Djavafx.platform=mac -Dmaven.test.skip=true -DworkEnv=ci -Pjavadoc-with-links package"
218245
sh '''cp cg/target/javafxTool-cg.jar javafxTool-cg.jar
219246
cp -r cg/target/lib lib
220247
cp -r cg/target/reports/apidocs apidocs
@@ -243,14 +270,14 @@ rm -r license'''
243270
stage('Prepare Linux Build') {
244271
steps {
245272
timeout(time: 10, unit: 'MINUTES') {
246-
sh "$M2_HOME/bin/mvn -f pom.xml -s $M2_HOME/conf/settings.xml -Djavafx.platform=linux -Dmaven.test.skip=true -Dmaven.javadoc.skip=true clean -T 1C install"
273+
sh "$M2_HOME/bin/mvn -f pom.xml -s $M2_HOME/conf/settings.xml -Djavafx.platform=linux -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -DworkEnv=ci clean -T 1C install"
247274
}
248275
}
249276
}
250277

251278
stage('Build smc-linux') {
252279
steps {
253-
sh "$M2_HOME/bin/mvn -f smc/pom.xml -s $M2_HOME/conf/settings.xml -Duser.name=${USER_NAME} -Djavafx.platform=linux -Dmaven.test.skip=true -Pjavadoc-with-links package"
280+
sh "$M2_HOME/bin/mvn -f smc/pom.xml -s $M2_HOME/conf/settings.xml -Duser.name=${USER_NAME} -Djavafx.platform=linux -Dmaven.test.skip=true -DworkEnv=ci -Pjavadoc-with-links package"
254281
sh '''cp smc/target/javafxTool-smc.jar javafxTool-smc.jar
255282
cp -r smc/target/lib lib
256283
cp -r smc/target/reports/apidocs apidocs
@@ -278,7 +305,7 @@ rm -r license'''
278305

279306
stage('Build qe-linux') {
280307
steps {
281-
sh "$M2_HOME/bin/mvn -f qe/pom.xml -s $M2_HOME/conf/settings.xml -Duser.name=${USER_NAME} -Djavafx.platform=linux -Dmaven.test.skip=true -Pjavadoc-with-links package"
308+
sh "$M2_HOME/bin/mvn -f qe/pom.xml -s $M2_HOME/conf/settings.xml -Duser.name=${USER_NAME} -Djavafx.platform=linux -Dmaven.test.skip=true -DworkEnv=ci -Pjavadoc-with-links package"
282309
sh '''cp qe/target/javafxTool-qe.jar javafxTool-qe.jar
283310
cp -r qe/target/lib lib
284311
cp -r qe/target/reports/apidocs apidocs
@@ -306,7 +333,7 @@ rm -r license'''
306333

307334
stage('Build cg-linux') {
308335
steps {
309-
sh "$M2_HOME/bin/mvn -f cg/pom.xml -s $M2_HOME/conf/settings.xml -Duser.name=${USER_NAME} -Djavafx.platform=linux -Dmaven.test.skip=true -Pjavadoc-with-links package"
336+
sh "$M2_HOME/bin/mvn -f cg/pom.xml -s $M2_HOME/conf/settings.xml -Duser.name=${USER_NAME} -Djavafx.platform=linux -Dmaven.test.skip=true -DworkEnv=ci -Pjavadoc-with-links package"
310337
sh '''cp cg/target/javafxTool-cg.jar javafxTool-cg.jar
311338
cp -r cg/target/lib lib
312339
cp -r cg/target/reports/apidocs apidocs

pom.xml

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@
7373
<maven-assembly-plugin.version>3.7.1</maven-assembly-plugin.version>
7474
<maven-shade-plugin.version>3.6.0</maven-shade-plugin.version>
7575
<maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
76+
<maven-antrun-plugin.version>3.1.0</maven-antrun-plugin.version>
77+
<buildnumber-maven-plugin.version>3.2.1</buildnumber-maven-plugin.version>
7678
<properties-maven-plugin.version>1.2.1</properties-maven-plugin.version>
7779
<license-maven-plugin.version>2.5.0</license-maven-plugin.version>
7880
<impsort-maven-plugin.version>1.12.0</impsort-maven-plugin.version>
@@ -1403,7 +1405,7 @@
14031405
<verbose>false</verbose>
14041406
<skip>false</skip>
14051407
<prefix>jfx-git</prefix>
1406-
<dotGitDirectory>$${project.basedir}/../.git</dotGitDirectory>
1408+
<dotGitDirectory>${project.basedir}/../.git</dotGitDirectory>
14071409
<generateGitPropertiesFile>true</generateGitPropertiesFile>
14081410
<generateGitPropertiesFilename>target/git.properties
14091411
</generateGitPropertiesFilename>
@@ -1529,6 +1531,24 @@
15291531
<wtpversion>2.0</wtpversion>
15301532
</configuration>
15311533
</plugin>
1534+
<plugin>
1535+
<groupId>org.apache.maven.plugins</groupId>
1536+
<artifactId>maven-antrun-plugin</artifactId>
1537+
<executions>
1538+
<execution>
1539+
<id>test</id>
1540+
<phase>test</phase>
1541+
<configuration>
1542+
<target unless="workEnv">
1543+
<echo message="You need to set -DworkEnv=ci in CI to skip some test cases, otherwise it defaults to dev in the development environment and when started from a jar the value is prod."/>
1544+
</target>
1545+
</configuration>
1546+
<goals>
1547+
<goal>run</goal>
1548+
</goals>
1549+
</execution>
1550+
</executions>
1551+
</plugin>
15321552
</plugins>
15331553

15341554
<pluginManagement>
@@ -1712,6 +1732,25 @@
17121732
</resources>
17131733
</configuration>
17141734
</execution>
1735+
<execution>
1736+
<id>copy-mf-licence</id>
1737+
<phase>process-sources</phase>
1738+
<goals>
1739+
<goal>copy-resources</goal>
1740+
</goals>
1741+
<configuration>
1742+
<outputDirectory>${project.build.directory}/classes/META-INF</outputDirectory>
1743+
<resources>
1744+
<resource>
1745+
<directory>${basedir}/../</directory>
1746+
<includes>
1747+
<include>LICENSE</include>
1748+
</includes>
1749+
<filtering>true</filtering>
1750+
</resource>
1751+
</resources>
1752+
</configuration>
1753+
</execution>
17151754
</executions>
17161755
</plugin>
17171756
<plugin>
@@ -1791,6 +1830,16 @@
17911830
<artifactId>maven-project-info-reports-plugin</artifactId>
17921831
<version>${maven-project-info-reports-plugin.version}</version>
17931832
</plugin>
1833+
<plugin>
1834+
<groupId>org.apache.maven.plugins</groupId>
1835+
<artifactId>maven-antrun-plugin</artifactId>
1836+
<version>${maven-antrun-plugin.version}</version>
1837+
</plugin>
1838+
<plugin>
1839+
<groupId>org.codehaus.mojo</groupId>
1840+
<artifactId>buildnumber-maven-plugin</artifactId>
1841+
<version>${buildnumber-maven-plugin.version}</version>
1842+
</plugin>
17941843
</plugins>
17951844
</pluginManagement>
17961845
</build>
@@ -1952,6 +2001,36 @@
19522001
</plugins>
19532002
</build>
19542003
</profile>
2004+
<profile>
2005+
<id>md5</id>
2006+
<build>
2007+
<plugins>
2008+
<plugin>
2009+
<groupId>org.apache.maven.plugins</groupId>
2010+
<artifactId>maven-antrun-plugin</artifactId>
2011+
<executions>
2012+
<execution>
2013+
<id>generate-md5</id>
2014+
<phase>package</phase>
2015+
<goals>
2016+
<goal>run</goal>
2017+
</goals>
2018+
<configuration>
2019+
<target>
2020+
<checksum algorithm="md5"
2021+
file="${project.build.directory}/${project.build.finalName}.jar"
2022+
property="md5.checksum"/>
2023+
<!--suppress UnresolvedMavenProperty -->
2024+
<echo file="${project.build.directory}/${project.build.finalName}.jar.MD5"
2025+
message="${md5.checksum}"/>
2026+
</target>
2027+
</configuration>
2028+
</execution>
2029+
</executions>
2030+
</plugin>
2031+
</plugins>
2032+
</build>
2033+
</profile>
19552034
</profiles>
19562035

19572036
<reporting>

0 commit comments

Comments
 (0)