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