fix: Make sure jar is always named GhydraMCP.jar

This commit is contained in:
Teal Bauer 2025-04-08 09:02:59 +02:00
parent 3a1772a3c9
commit d4122402b4
3 changed files with 24 additions and 29 deletions

18
pom.xml
View File

@ -26,6 +26,7 @@
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
<scope>provided</scope>
</dependency>
<!-- Ghidra JARs as system-scoped dependencies -->
@ -196,16 +197,16 @@
</configuration>
</plugin>
<!-- The Assembly Plugin for creating the Ghidra extension ZIP -->
<!-- The Assembly Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<executions>
<!-- Default execution for the plugin only -->
<!-- Execution for the Ghidra extension zip (runs first in package phase) -->
<execution>
<id>plugin-assembly</id>
<phase>prepare-package</phase> <!-- Run earlier to ensure zip exists for copy -->
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
@ -215,13 +216,11 @@
</descriptors>
<finalName>GhydraMCP-${git.commit.id.abbrev}-${maven.build.timestamp}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<!-- Don't attach artifact, we will copy it manually -->
<!-- <attach>true</attach> -->
<!-- <classifier>ghidra-extension</classifier> -->
<!-- Don't attach artifact -->
</configuration>
</execution>
<!-- Execution for the complete package -->
<!-- Execution for the complete package (runs second in package phase) -->
<execution>
<id>complete-package</id>
<phase>package</phase>
@ -239,7 +238,7 @@
</executions>
</plugin>
<!-- Copy the generated plugin zip to a staging area -->
<!-- Copy the generated plugin zip to a staging area in the verify phase -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
@ -247,7 +246,7 @@
<executions>
<execution>
<id>copy-plugin-zip</id>
<phase>package</phase> <!-- Run after plugin-assembly -->
<phase>verify</phase> <!-- Run after package phase -->
<goals>
<goal>copy-resources</goal>
</goals>
@ -257,6 +256,7 @@
<resource>
<directory>${project.build.directory}</directory>
<includes>
<!-- Use properties here as they should be resolved by verify phase -->
<include>GhydraMCP-${git.commit.id.abbrev}-${maven.build.timestamp}.zip</include>
</includes>
</resource>

View File

@ -24,9 +24,10 @@
<!-- Include the Ghidra plugin zip copied by maven-resources-plugin -->
<fileSet>
<directory>${project.build.directory}/staging</directory>
<directory>${project.build.directory}/staging</directory> <!-- Point to staging directory -->
<includes>
<include>GhydraMCP-*.zip</include>
<!-- Use exact pattern matching the staged file -->
<include>GhydraMCP-${git.commit.id.abbrev}-${maven.build.timestamp}.zip</include>
</includes>
<outputDirectory></outputDirectory>
</fileSet>

View File

@ -4,20 +4,14 @@
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3
http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<!-- Just a name for reference -->
<id>ghidra-extension</id>
<!-- We want a .zip file -->
<formats>
<format>zip</format>
</formats>
<!-- Don't put everything in an extra top-level directory named after the assembly ID -->
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<!-- 1) Copy extension.properties and Module.manifest into the top level
of a folder named GhydraMCP/ (the actual extension folder). -->
<!-- Copy extension files to GhydraMCP/ directory -->
<fileSet>
<directory>src/main/resources</directory>
<includes>
@ -26,15 +20,15 @@
</includes>
<outputDirectory>GhydraMCP</outputDirectory>
</fileSet>
<!-- 2) Copy your built plugin JAR into GhydraMCP/lib -->
<fileSet>
<directory>${project.build.directory}</directory>
<includes>
<!-- Use the finalized JAR name from the maven-jar-plugin -->
<include>GhydraMCP.jar</include>
</includes>
<outputDirectory>GhydraMCP/lib</outputDirectory>
</fileSet>
</fileSets>
<dependencySets>
<!-- Include the main project JAR as GhydraMCP.jar -->
<dependencySet>
<useProjectArtifact>true</useProjectArtifact>
<outputDirectory>GhydraMCP/lib</outputDirectory>
<outputFileNameMapping>GhydraMCP.jar</outputFileNameMapping>
<unpack>false</unpack>
</dependencySet>
</dependencySets>
</assembly>