将现有的spring应用程序迁移到spring boot。我可以作为spring boot应用程序运行。当我通过命令提示符运行jar文件时,显示“没有主清单属性”。现在在pom.xml文件中添加以下插件.previous错误已解决。
pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.services.api.ServiceMain</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy</id>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/lib
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
现在显示另一个错误
manifest.mf
Manifest-Version: 1.0
Implementation-Title: Service
Implementation-Version: 7.0.0.0
Archiver-Version: Plexus Archiver
Built-By: Administrator
Implementation-Vendor-Id: MainProject
Class-Path: lib/abc-1.0.jar lib/abc1-1.0.jar
Created-By: Apache Maven 3.3.9
Build-Jdk: 1.8.0_202
Implementation-URL: http://maven.apache.org
Main-Class: com.services.api.ServiceMain
lib文件夹不存在于我的目标或jar文件中,并且我的jar文件大小仅为64 kb。
使用以下逗号构建我的应用程序
clean install
我该如何解决此问题。已经通过一些堆栈溢出链接,无法解决我的问题
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<start-class>org.springframework.boot.loader.JarLauncher</start-class>
</configuration>
</execution>
</executions>
</plugin>