弹簧启动:无法用 maven 创建耳朵:无法推断布局



我有一个带有war和ear模块的SpringBoot项目,我使用maven(主要用于Java项目的构建自动化工具(和IntelliJ IDEA构建 这是我对战争项目的pom.xml:

<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.bendiciones</groupId>
<artifactId>bendiciones-parent</artifactId>
<version>4.0.0-SNAPSHOT</version>
</parent>
<artifactId>bendiciones-ear</artifactId>
<packaging>ear</packaging>

<dependencies>
<dependency>
<groupId>com.bendiciones</groupId>
<artifactId>bendiciones-war</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
</dependencies>


<build>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<finalName>${project.build.finalName}-${project.version}</finalName>
<earSourceDirectory>src/main/resources</earSourceDirectory>
<packagingExcludes>**/*.jar</packagingExcludes>
<modules>
<webModule>
<groupId>com.bendiciones</groupId>
<artifactId>bendiciones-war</artifactId>
<contextRoot>/bendiciones</contextRoot>
<bundleFileName>bendiciones.war</bundleFileName>
</webModule>
</modules>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<releaseProfiles>release</releaseProfiles>
<autoVersionSubmodules>true</autoVersionSubmodules>
<preparationGoals>clean install</preparationGoals>
<arguments>-DaltDeploymentRepository=releases::default::http://el1881.bc:8081/nexus/content/repositories/MicroserviceReleases</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<layout>NONE</layout>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<finalName>bendiciones</finalName>
</build>

</project>

但是当我构建类时,我遇到了这个错误:

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.5.RELEASE:repackage (repackage) on project bendiciones-ear: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.1.5.RELEASE:repackage failed: Unable to deduce layout for '/bendiciones/bendiciones-ear/target/bendiciones-4.0.0-SNAPSHOT.ear' -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.5.RELEASE:repackage (repackage) on project bendiciones-ear: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.1.5.RELEASE:repackage failed: Unable to deduce layout for '/bendiciones/bendiciones-ear/target/bendiciones-4.0.0-SNAPSHOT.ear'
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)

尝试从您的顶级 pom 中删除以下内容...

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

最新更新