普通打包以后在程序目录运行,或者编写bat运行时会提示“没有主清单属性”,这是由于并无找到main()方法,须要咱们指明告诉java程序java
我bat中的代码web
@echo off title mytitle java -jar ysl-ts-web-base-1.0-SNAPSHOT.jar pause
个人程序是spring boot的,不一样的程序配置有些不一样,在pom.xml中增长如下配置,指明启动类位置便可spring
<!--配置spring boot打包(可运行jar包)--> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <configuration> <mainClass>com.ysl.ts.core.service.base.ServiceBaseApp</mainClass> </configuration> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
其中“com.ysl.ts.core.service.base.ServiceBaseApp”是个人main()方法的类,各自修改便可maven
把maven claen一下再package再运行就能够了spring-boot