【发布时间】:2020-01-30 14:51:58
【问题描述】:
我正在将现有的 spring 应用程序迁移到 spring boot。我无法将它作为 spring boot 应用程序运行。当我通过命令提示符运行 jar 文件时,它显示“no main manifest attribute”。现在正在添加以下插件我的 pom.xml 文件。之前的错误已解决。
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>
现在显示另一个错误
清单.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
我该如何解决这个问题。已经通过一些堆栈溢出链接,没有解决我的问题
【问题讨论】:
标签: maven spring-boot maven-plugin