Skip to content

Commit fc011c9

Browse files
committed
Fix problems with deploy
Use ManifestResourceTransformer instead of jar plugin for agent jar to set manifest entries, as there are problems when executing deploy otherwise which are related to jar being executed multiple times: You have to use a classifier to attach supplemental artifacts to the project instead of replacing them. Signed-off-by: Felix Barnsteiner <[email protected]>
1 parent aeb7903 commit fc011c9

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

elastic-apm-agent/pom.xml

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@
6767
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
6868
<addHeader>false</addHeader>
6969
</transformer>
70+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
71+
<manifestEntries>
72+
<Premain-Class>${elastic.apm.agent}</Premain-Class>
73+
<Agent-Class>${elastic.apm.agent}</Agent-Class>
74+
<Can-Redefine-Classes>true</Can-Redefine-Classes>
75+
<Can-Retransform-Classes>true</Can-Retransform-Classes>
76+
<Can-Set-Native-Method-Prefix>true</Can-Set-Native-Method-Prefix>
77+
<Automatic-Module-Name>${project.groupId}.agent</Automatic-Module-Name>
78+
</manifestEntries>
79+
</transformer>
7080
</transformers>
7181
</configuration>
7282
</execution>
@@ -91,24 +101,6 @@
91101
</execution>
92102
</executions>
93103
</plugin>
94-
<!-- Specify agent manifest headers. -->
95-
<plugin>
96-
<groupId>org.apache.maven.plugins</groupId>
97-
<artifactId>maven-jar-plugin</artifactId>
98-
<version>${version.plugin.jar}</version>
99-
<configuration>
100-
<archive>
101-
<manifestEntries>
102-
<Premain-Class>${elastic.apm.agent}</Premain-Class>
103-
<Agent-Class>${elastic.apm.agent}</Agent-Class>
104-
<Can-Redefine-Classes>true</Can-Redefine-Classes>
105-
<Can-Retransform-Classes>true</Can-Retransform-Classes>
106-
<Can-Set-Native-Method-Prefix>true</Can-Set-Native-Method-Prefix>
107-
<Automatic-Module-Name>${project.groupId}.agent</Automatic-Module-Name>
108-
</manifestEntries>
109-
</archive>
110-
</configuration>
111-
</plugin>
112104
</plugins>
113105
</build>
114106

0 commit comments

Comments
 (0)