Skip to content

Commit e0f1d20

Browse files
committed
Java:解决 maven package 打 jar 包运行报错没有主清单属性
1 parent 23451f1 commit e0f1d20

File tree

2 files changed

+35
-23
lines changed
  • APIJSON-Java-Server

2 files changed

+35
-23
lines changed

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/pom.xml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<groupId>apijson.boot</groupId>
77
<artifactId>apijson-boot-multi-datasource</artifactId>
88
<version>5.1.5</version>
9-
<!-- <packaging>jar</packaging> -->
9+
<packaging>jar</packaging>
1010

1111
<name>APIJSONBoot-MultiDataSource</name>
1212
<description>Demo project for APIJSON Server based on SpringBoot</description>
@@ -18,12 +18,12 @@
1818
</properties>
1919

2020
<dependencies>
21-
<!-- JDK 11+ 需要,否则启动报错 NoClassDefFoundError: javax/activation/UnsupportedDataTypeException -->
22-
<dependency>
23-
<groupId>javax.activation</groupId>
24-
<artifactId>activation</artifactId>
25-
<version>1.1.1</version>
26-
</dependency>
21+
<!-- JDK 11+ 需要,否则启动报错 NoClassDefFoundError: javax/activation/UnsupportedDataTypeException -->
22+
<dependency>
23+
<groupId>javax.activation</groupId>
24+
<artifactId>activation</artifactId>
25+
<version>1.1.1</version>
26+
</dependency>
2727

2828
<!-- APIJSON 需要用的依赖库,1.2.0 以上 -->
2929
<dependency>
@@ -39,8 +39,7 @@
3939
<version>4.0.1</version>
4040
</dependency>
4141

42-
<!-- 单元测试:可使用 libs 目录的 unitauto-java.jar 和 unitauto-jar.jar 来替代,两种方式二选一
43-
<<<<<<<<< -->
42+
<!-- 单元测试:可使用 libs 目录的 unitauto-java.jar 和 unitauto-jar.jar 来替代,两种方式二选一 <<<<<<<<< -->
4443
<dependency>
4544
<groupId>com.github.TommyLemon</groupId>
4645
<artifactId>unitauto-java</artifactId>
@@ -64,12 +63,11 @@
6463
<groupId>com.github.Tencent</groupId>
6564
<artifactId>APIJSON</artifactId>
6665
<version>5.1.5</version>
67-
<scope>compile</scope>
6866
</dependency>
69-
<dependency>
67+
<dependency>
7068
<groupId>com.github.APIJSON</groupId>
7169
<artifactId>apijson-framework</artifactId>
72-
<version>5.1.5</version>
70+
<version>5.1.5</version>
7371
</dependency>
7472
<dependency>
7573
<groupId>com.github.APIJSON</groupId>
@@ -131,6 +129,13 @@
131129
<plugin>
132130
<groupId>org.springframework.boot</groupId>
133131
<artifactId>spring-boot-maven-plugin</artifactId>
132+
<executions>
133+
<execution>
134+
<goals>
135+
<goal>repackage</goal>
136+
</goals>
137+
</execution>
138+
</executions>
134139
</plugin>
135140
<plugin>
136141
<groupId>org.apache.maven.plugins</groupId>

APIJSON-Java-Server/APIJSONBoot/pom.xml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<groupId>apijson.boot</groupId>
77
<artifactId>apijson-boot</artifactId>
88
<version>5.1.5</version>
9-
<!-- <packaging>jar</packaging> -->
9+
<packaging>jar</packaging>
1010

1111
<name>APIJSONBoot</name>
1212
<description>Demo project for APIJSON Server based on SpringBoot</description>
@@ -18,12 +18,12 @@
1818
</properties>
1919

2020
<dependencies>
21-
<!-- JDK 11+ 需要,否则启动报错 NoClassDefFoundError: javax/activation/UnsupportedDataTypeException -->
22-
<dependency>
23-
<groupId>javax.activation</groupId>
24-
<artifactId>activation</artifactId>
25-
<version>1.1.1</version>
26-
</dependency>
21+
<!-- JDK 11+ 需要,否则启动报错 NoClassDefFoundError: javax/activation/UnsupportedDataTypeException -->
22+
<dependency>
23+
<groupId>javax.activation</groupId>
24+
<artifactId>activation</artifactId>
25+
<version>1.1.1</version>
26+
</dependency>
2727

2828
<!-- APIJSON 需要用的依赖库,1.2.0 以上 -->
2929
<dependency>
@@ -53,7 +53,7 @@
5353
<dependency>
5454
<groupId>io.github.classgraph</groupId>
5555
<artifactId>classgraph</artifactId>
56-
<version>4.8.87</version>
56+
<version>4.8.146</version>
5757
</dependency>
5858
<!-- 单元测试:可使用 libs 目录的 unitauto-java.jar 和 unitauto-jar.jar 来替代,两种方式二选一 >>>>>>>>> -->
5959

@@ -64,7 +64,7 @@
6464
<artifactId>APIJSON</artifactId>
6565
<version>5.1.5</version>
6666
</dependency>
67-
<dependency>
67+
<dependency>
6868
<groupId>com.github.APIJSON</groupId>
6969
<artifactId>apijson-framework</artifactId>
7070
<version>5.1.5</version>
@@ -80,12 +80,12 @@
8080
<dependency>
8181
<groupId>mysql</groupId>
8282
<artifactId>mysql-connector-java</artifactId>
83-
<version>8.0.27</version>
83+
<version>8.0.29</version>
8484
</dependency>
8585
<dependency>
8686
<groupId>org.postgresql</groupId>
8787
<artifactId>postgresql</artifactId>
88-
<version>42.2.18</version>
88+
<version>42.3.4</version>
8989
</dependency>
9090
<dependency>
9191
<groupId>net.sourceforge.jtds</groupId>
@@ -110,6 +110,13 @@
110110
<plugin>
111111
<groupId>org.springframework.boot</groupId>
112112
<artifactId>spring-boot-maven-plugin</artifactId>
113+
<executions>
114+
<execution>
115+
<goals>
116+
<goal>repackage</goal>
117+
</goals>
118+
</execution>
119+
</executions>
113120
</plugin>
114121
<plugin>
115122
<groupId>org.apache.maven.plugins</groupId>

0 commit comments

Comments
 (0)