-
Notifications
You must be signed in to change notification settings - Fork 0
/
patch-pom.sh
executable file
·96 lines (94 loc) · 4.06 KB
/
patch-pom.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#! /bin/bash
echo "Changing pom.xml"
PROFILES=$(cat << EOF
<profile>
<id>sonatype-oss-snapshot</id>
<distributionManagement>
<snapshotRepository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
</profile>
<profile>
<id>github</id>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/sfuhrm/checkmk-java-client</url>
</repository>
</distributionManagement>
</profile>
<profile>
<id>sonatype-oss-release</id>
<distributionManagement>
<repository>
<id>sonatype</id>
<name>Central Repository OSSRH</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<keyname>0AC5A45E91FA93DA25380017B0D87B063EAD41F1</keyname>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
EOF
)
# update license and some dependency versions
cat pom.xml |
xmlstarlet edit -N "pom=http://maven.apache.org/POM/4.0.0" \
--update "/pom:project/pom:licenses/pom:license/pom:name" --value "GNU General Public License, Version 2" \
--update "/pom:project/pom:licenses/pom:license/pom:url" --value "https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt" \
--update "/pom:project/pom:properties/pom:okhttp-version" --value "4.12.0" \
--update "/pom:project/pom:properties/pom:gson-version" --value "2.10.1" \
--update "/pom:project/pom:properties/pom:jackson-databind-nullable-version" --value "0.2.6" \
--update "/pom:project/pom:properties/pom:commons-lang3-version" --value "3.13.0" \
| \
awk -v PROFILES="$PROFILES" > pom.xml.new '
/<\/profiles>/ { print PROFILES; }
{ print $0; q}
' && mv pom.xml.new pom.xml