Skip to content

Commit 1a2fb85

Browse files
committed
Generate automatic module name using maven-jar-plugin. Remove OSGi configuration, as causes duplicate classes, causing split package problem across mcp-json and mcp-core.
1 parent 082444e commit 1a2fb85

File tree

2 files changed

+24
-45
lines changed

2 files changed

+24
-45
lines changed

mcp-core/pom.xml

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -20,50 +20,6 @@
2020
<developerConnection>[email protected]/modelcontextprotocol/java-sdk.git</developerConnection>
2121
</scm>
2222

23-
<build>
24-
<plugins>
25-
<plugin>
26-
<groupId>biz.aQute.bnd</groupId>
27-
<artifactId>bnd-maven-plugin</artifactId>
28-
<version>${bnd-maven-plugin.version}</version>
29-
<executions>
30-
<execution>
31-
<id>bnd-process</id>
32-
<goals>
33-
<goal>bnd-process</goal>
34-
</goals>
35-
<configuration>
36-
<bnd><![CDATA[
37-
Bundle-Name: Bundle ${project.groupId} : ${project.artifactId}
38-
version: ${versionmask;===;${version_cleanup;${project.version}}}
39-
Bundle-SymbolicName: ${project.groupId}.${project.artifactId}
40-
Bundle-Version: ${version}
41-
Automatic-Module-Name: ${project.groupId}.${project.artifactId}
42-
Import-Package: jakarta.*;resolution:=optional, \
43-
*;
44-
Export-Package: io.modelcontextprotocol.*;version="${version}";-noimport:=true
45-
-noimportjava: true;
46-
-nouses: true;
47-
-removeheaders: Private-Package
48-
]]>
49-
</bnd>
50-
</configuration>
51-
</execution>
52-
</executions>
53-
</plugin>
54-
55-
<plugin>
56-
<groupId>org.apache.maven.plugins</groupId>
57-
<artifactId>maven-jar-plugin</artifactId>
58-
<configuration>
59-
<archive>
60-
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
61-
</archive>
62-
</configuration>
63-
</plugin>
64-
</plugins>
65-
</build>
66-
6723
<dependencies>
6824
<dependency>
6925
<groupId>io.modelcontextprotocol.sdk</groupId>

pom.xml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
<bnd-maven-plugin.version>7.1.0</bnd-maven-plugin.version>
9898
<json-unit-assertj.version>4.1.0</json-unit-assertj.version>
9999
<json-schema-validator.version>2.0.0</json-schema-validator.version>
100-
100+
<build-helper-maven-plugin.version>3.6.1</build-helper-maven-plugin.version>
101101
</properties>
102102

103103
<modules>
@@ -113,6 +113,28 @@
113113

114114
<build>
115115
<plugins>
116+
<!-- Derive automatic module name from groupId, artifactId, replacing '-' with '.' -->
117+
<plugin>
118+
<groupId>org.codehaus.mojo</groupId>
119+
<artifactId>build-helper-maven-plugin</artifactId>
120+
<version>${build-helper-maven-plugin.version}</version>
121+
<executions>
122+
<execution>
123+
<id>rename-property</id>
124+
<goals>
125+
<goal>regex-property</goal>
126+
</goals>
127+
<phase>validate</phase>
128+
<configuration>
129+
<name>automatic.module.name</name>
130+
<value>${project.groupId}.${project.artifactId}</value>
131+
<regex>-</regex>
132+
<replacement>.</replacement>
133+
<failIfNoMatch>false</failIfNoMatch>
134+
</configuration>
135+
</execution>
136+
</executions>
137+
</plugin>
116138
<plugin>
117139
<groupId>io.spring.javaformat</groupId>
118140
<artifactId>spring-javaformat-maven-plugin</artifactId>
@@ -206,6 +228,7 @@
206228
<manifestEntries>
207229
<Implementation-Title>${project.artifactId}</Implementation-Title>
208230
<Implementation-Version>${project.version}</Implementation-Version>
231+
<Automatic-Module-Name>${automatic.module.name}</Automatic-Module-Name>
209232
</manifestEntries>
210233
</archive>
211234
</configuration>

0 commit comments

Comments
 (0)