瀏覽代碼

解决执行jar包找不到主类问题

yanzheng 1 年之前
父節點
當前提交
8b2ffdb757

+ 54 - 1
pom.xml

@@ -9,7 +9,17 @@
     <description>gateservice</description>
     <properties>
         <java.version>1.8</java.version>
+      <!--  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>-->
+        <maven.compiler.source>1.8</maven.compiler.source>
+        <maven.compiler.target>1.8</maven.compiler.target>
+        <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
     </properties>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>1.5.8.RELEASE</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
     <dependencies>
         <!--SpringBoot启动依赖-->
         <dependency>
@@ -50,17 +60,60 @@
             <version>2.0.23</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.greentech.netsdk</groupId>
+            <artifactId>netsdk</artifactId>
+            <version>1.0</version>
+            <scope>system</scope>
+            <systemPath>${pom.basedir}/lib/netsdk.jar</systemPath>
+        </dependency>
+ <!--       <dependency>
+            <groupId>com.greentech.jna</groupId>
+            <artifactId>jna</artifactId>
+            <version>1.0</version>
+            <scope>system</scope>
+            <systemPath>${pom.basedir}/lib/jna.jar</systemPath>
+        </dependency>-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+            <version>2.6.2</version>
+        </dependency>
+
     </dependencies>
 
     <build>
+        <defaultGoal>compile</defaultGoal>
         <plugins>
+          <!--  <plugin>
+                <groupId>com.greentech.jna</groupId>
+                <artifactId>jna</artifactId>
+                <version>1.0</version>
+            </plugin>-->
+            <!--<plugin>
+                <groupId>com.greentech.netsdk</groupId>
+                <artifactId>netsdk</artifactId>
+                <version>1.0</version>
+            </plugin>-->
             <!--添加mybatis generator maven插件-->
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <version>2.3.4.RELEASE</version>
+                <configuration>
+                    <includeSystemScope>true</includeSystemScope>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>3.2.0</version>
+                <configuration>
+                    <archive>
+                        <manifestFile>${project.basedir}/src/main/java/com/greentech/gateservice/META-INF/MANIFEST.MF</manifestFile>
+                    </archive>
+                </configuration>
             </plugin>
-
             <plugin>
                 <groupId>org.mybatis.generator</groupId>
                 <artifactId>mybatis-generator-maven-plugin</artifactId>

+ 2 - 2
src/main/java/com/greentech/gateservice/GateserviceApplication.java → src/main/java/com/greentech/gateservice/GateServiceApplication.java

@@ -7,10 +7,10 @@ import org.springframework.scheduling.annotation.EnableScheduling;
 
 @SpringBootApplication
 @EnableScheduling
-public class GateserviceApplication {
+public class GateServiceApplication {
 
     public static void main(String[] args) {
-        SpringApplication.run(GateserviceApplication.class, args);
+        SpringApplication.run(GateServiceApplication.class, args);
     }
 
 }

+ 1 - 1
src/main/java/com/greentech/gateservice/META-INF/MANIFEST.MF

@@ -1,3 +1,3 @@
 Manifest-Version: 1.0
-Main-Class: com.greentech.gateservice.GateserviceApplication
+Main-Class: com.greentech.gateservice.GateServiceApplication
 

+ 1 - 1
src/main/resources/META-INF/MANIFEST.MF

@@ -1,3 +1,3 @@
 Manifest-Version: 1.0
-Main-Class: com.greentech.gateservice.GateserviceApplication
+Main-Class: com.greentech.gateservice.GateServiceApplication
 

+ 1 - 1
src/test/java/com/greentech/gateservice/GateserviceApplicationTests.java

@@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test;
 import org.springframework.boot.test.context.SpringBootTest;
 
 @SpringBootTest
-class GateserviceApplicationTests {
+class GateServiceApplicationTests {
 
     @Test
     void contextLoads() {