• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?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" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3    <modelVersion>4.0.0</modelVersion>
4
5    <parent>
6        <groupId>net.bytebuddy</groupId>
7        <artifactId>byte-buddy-parent</artifactId>
8        <version>1.14.18</version>
9    </parent>
10
11    <artifactId>byte-buddy-agent</artifactId>
12    <packaging>jar</packaging>
13
14    <properties>
15        <bytebuddy.agent>net.bytebuddy.agent.Installer</bytebuddy.agent>
16        <attach.package.sun>com.sun.tools.attach</attach.package.sun>
17        <attach.package.ibm>com.ibm.tools.attach</attach.package.ibm>
18        <packages.list>net.bytebuddy.agent,net.bytebuddy.agent.utility.nullability</packages.list>
19        <native.compiler.32>i686-w64-mingw32-gcc</native.compiler.32>
20        <native.compiler.64>x86_64-w64-mingw32-gcc</native.compiler.64>
21        <net.bytebuddy.test.jnapath />
22    </properties>
23
24    <name>Byte Buddy agent</name>
25    <description>The Byte Buddy agent offers convenience for attaching an agent to the local or a remote VM.</description>
26
27    <!--
28      The JNA dependency can be excluded safely. Byte Buddy will safely discover the
29      non-availability and not use the corresponding virtual machine implementation. The
30      implementation requires Java 7+ and is deactivated on Java 6 VMs.
31    -->
32
33    <dependencies>
34        <dependency>
35            <groupId>net.java.dev.jna</groupId>
36            <artifactId>jna</artifactId>
37            <version>${version.jna}</version>
38            <scope>provided</scope>
39        </dependency>
40        <dependency>
41            <groupId>net.java.dev.jna</groupId>
42            <artifactId>jna-platform</artifactId>
43            <version>${version.jna}</version>
44            <scope>provided</scope>
45        </dependency>
46        <dependency>
47            <groupId>junit</groupId>
48            <artifactId>junit</artifactId>
49            <version>${version.junit}</version>
50            <scope>test</scope>
51        </dependency>
52        <dependency>
53            <groupId>org.mockito</groupId>
54            <artifactId>mockito-core</artifactId>
55            <version>${version.mockito}</version>
56            <scope>test</scope>
57            <exclusions>
58                <exclusion>
59                    <groupId>net.bytebuddy</groupId>
60                    <artifactId>byte-buddy</artifactId>
61                </exclusion>
62                <exclusion>
63                    <groupId>net.bytebuddy</groupId>
64                    <artifactId>byte-buddy-agent</artifactId>
65                </exclusion>
66            </exclusions>
67        </dependency>
68        <!-- Include last version of Byte Buddy manually. -->
69        <dependency>
70            <groupId>net.bytebuddy</groupId>
71            <artifactId>byte-buddy</artifactId>
72            <version>1.14.17</version>
73            <scope>test</scope>
74        </dependency>
75    </dependencies>
76
77    <build>
78        <resources>
79            <resource>
80                <directory>src/main/resources</directory>
81            </resource>
82            <resource>
83                <directory>..</directory>
84                <targetPath>META-INF</targetPath>
85                <filtering>true</filtering>
86                <includes>
87                    <include>LICENSE</include>
88                    <include>NOTICE</include>
89                </includes>
90            </resource>
91        </resources>
92        <plugins>
93            <!-- Allow for specifying a custom library path for JNA. -->
94            <plugin>
95                <groupId>org.apache.maven.plugins</groupId>
96                <artifactId>maven-surefire-plugin</artifactId>
97                <version>${version.plugin.surefire}</version>
98                <configuration combine.children="append">
99                    <argLine>-Djna.library.path=${net.bytebuddy.test.jnapath} ${surefire.arguments}</argLine>
100                </configuration>
101            </plugin>
102            <!-- Create manifest file which is required for creating an OSGi bundle. -->
103            <plugin>
104                <groupId>org.apache.maven.plugins</groupId>
105                <artifactId>maven-jar-plugin</artifactId>
106                <version>${version.plugin.jar}</version>
107                <configuration>
108                    <archive>
109                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
110                    </archive>
111                </configuration>
112            </plugin>
113            <!-- Specify OSGi packaging and agent manifest headers. -->
114            <plugin>
115                <groupId>org.apache.felix</groupId>
116                <artifactId>maven-bundle-plugin</artifactId>
117                <version>${version.plugin.bundle}</version>
118                <executions>
119                    <execution>
120                        <phase>process-classes</phase>
121                        <goals>
122                            <goal>manifest</goal>
123                        </goals>
124                        <configuration>
125                            <instructions>
126                                <Multi-Release>true</Multi-Release>
127                                <Premain-Class>${bytebuddy.agent}</Premain-Class>
128                                <Agent-Class>${bytebuddy.agent}</Agent-Class>
129                                <Can-Redefine-Classes>true</Can-Redefine-Classes>
130                                <Can-Retransform-Classes>true</Can-Retransform-Classes>
131                                <Can-Set-Native-Method-Prefix>true</Can-Set-Native-Method-Prefix>
132                                <Import-Package>
133                                    ${attach.package.sun};resolution:="optional",
134                                    ${attach.package.ibm};resolution:="optional"
135                                </Import-Package>
136                                <Export-Package>${packages.list}</Export-Package>
137                            </instructions>
138                        </configuration>
139                    </execution>
140                </executions>
141            </plugin>
142            <!-- Create a module-info.class file. -->
143            <plugin>
144                <groupId>codes.rafael.modulemaker</groupId>
145                <artifactId>modulemaker-maven-plugin</artifactId>
146                <version>${version.plugin.modulemaker}</version>
147                <dependencies>
148                    <dependency>
149                        <groupId>org.ow2.asm</groupId>
150                        <artifactId>asm</artifactId>
151                        <version>${version.asm}</version>
152                    </dependency>
153                </dependencies>
154                <executions>
155                    <execution>
156                        <phase>prepare-package</phase>
157                        <goals>
158                            <goal>make-module</goal>
159                        </goals>
160                        <configuration>
161                            <skip>${modulemaker.skip}</skip>
162                            <name>${project.groupId}.agent</name>
163                            <version>${project.version}</version>
164                            <multirelease>true</multirelease>
165                            <packages>${packages.list}</packages>
166                            <exports>${packages.list}</exports>
167                            <requires>java.instrument</requires>
168                            <static-requires>
169                                jdk.attach,
170                                com.sun.jna,
171                                com.sun.jna.platform
172                            </static-requires>
173                        </configuration>
174                    </execution>
175                </executions>
176            </plugin>
177        </plugins>
178    </build>
179
180    <profiles>
181        <profile>
182            <id>native-compile</id>
183            <activation>
184                <activeByDefault>false</activeByDefault>
185            </activation>
186            <build>
187                <plugins>
188                    <plugin>
189                        <groupId>org.codehaus.mojo</groupId>
190                        <artifactId>exec-maven-plugin</artifactId>
191                        <version>${version.plugin.exec}</version>
192                        <executions>
193                            <execution>
194                                <id>compile-32</id>
195                                <phase>compile</phase>
196                                <goals>
197                                    <goal>exec</goal>
198                                </goals>
199                                <configuration>
200                                    <executable>${native.compiler.32}</executable>
201                                    <arguments>
202                                        <argument>-shared</argument>
203                                        <argument>-o</argument>
204                                        <argument>${project.basedir}/src/main/resources/win32-x86/attach_hotspot_windows.dll</argument>
205                                        <argument>${project.basedir}/src/main/c/attach_hotspot_windows.c</argument>
206                                    </arguments>
207                                </configuration>
208                            </execution>
209                            <execution>
210                                <id>compile-64</id>
211                                <phase>compile</phase>
212                                <goals>
213                                    <goal>exec</goal>
214                                </goals>
215                                <configuration>
216                                    <executable>${native.compiler.64}</executable>
217                                    <arguments>
218                                        <argument>-shared</argument>
219                                        <argument>-o</argument>
220                                        <argument>${project.basedir}/src/main/resources/win32-x86-64/attach_hotspot_windows.dll</argument>
221                                        <argument>${project.basedir}/src/main/c/attach_hotspot_windows.c</argument>
222                                    </arguments>
223                                </configuration>
224                            </execution>
225                        </executions>
226                    </plugin>
227                </plugins>
228            </build>
229        </profile>
230    </profiles>
231</project>
232