forked from rmaafs/WelcomeTale
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpom.xml
More file actions
191 lines (180 loc) · 8.44 KB
/
pom.xml
File metadata and controls
191 lines (180 loc) · 8.44 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.rmaafs.welcometale</groupId>
<artifactId>WelcomeTale</artifactId>
<version>1.3.0</version>
<packaging>jar</packaging>
<name>WelcomeTale</name>
<properties>
<maven.compiler.source>25</maven.compiler.source>
<maven.compiler.target>25</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Configure these paths via environment variables (see .env file) -->
<hytale.mods.dir>${env.HYTALE_MODS_DIR}</hytale.mods.dir>
<hytale.server.jar>${env.HYTALE_SERVER_JAR}</hytale.server.jar>
</properties>
<dependencies>
<dependency>
<groupId>com.hypixel.hytale</groupId>
<artifactId>Server</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${hytale.server.jar}</systemPath>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.9.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<source>25</source>
<target>25</target>
</configuration>
</plugin>
<!-- Step 1: Unpack ASM dependency -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.9.0</version>
<executions>
<execution>
<id>unpack-asm</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.9.1</version>
<outputDirectory>${project.build.directory}/transformer-temp</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<!-- Step 2: Create transformer JAR with ASM classes -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.0</version>
<executions>
<!-- Create transformer JAR -->
<execution>
<id>transformer-jar</id>
<phase>prepare-package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>transformer</classifier>
<classesDirectory>${project.build.directory}/transformer-temp</classesDirectory>
<includes>
<include>org/objectweb/asm/**</include>
</includes>
</configuration>
</execution>
<!-- Main JAR excluding transformer classes -->
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<excludes>
<exclude>**/transformers/**</exclude>
<exclude>META-INF/services/com.hypixel.hytale.plugin.early.ClassTransformer</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
<!-- Step 3: Use antrun to build the complete transformer JAR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>create-transformer-jar</id>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<mkdir dir="${project.build.directory}/earlyplugins"/>
<!-- Create the transformer JAR with both ASM and transformer classes -->
<jar destfile="${project.build.directory}/earlyplugins/LeaveMessageTransformer.jar">
<!-- Include unpacked ASM classes -->
<fileset dir="${project.build.directory}/transformer-temp" includes="org/objectweb/asm/**"/>
<!-- Include transformer classes from compiled classes -->
<fileset dir="${project.build.outputDirectory}" includes="com/rmaafs/welcometale/transformers/**"/>
<fileset dir="${project.build.outputDirectory}" includes="META-INF/services/com.hypixel.hytale.plugin.early.ClassTransformer"/>
</jar>
</target>
</configuration>
</execution>
<!-- Embed transformer JAR in main JAR -->
<execution>
<id>repackage-with-transformer</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- Add the transformer JAR to the main JAR -->
<jar destfile="${project.build.directory}/${project.build.finalName}.jar"
update="true">
<fileset dir="${project.build.directory}" includes="earlyplugins/**"/>
</jar>
</target>
</configuration>
</execution>
</executions>
</plugin>
<!-- Copy final JAR to mods directory -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.4.0</version>
<executions>
<execution>
<id>copy-jar-to-mods</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${hytale.mods.dir}</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}</directory>
<includes>
<include>${project.build.finalName}.jar</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>