spring - SpringBoot:无法使用 maven 创建耳朵:无法推断布局
问题描述
我有一个带有 war 和 ear 模块的 SpringBoot 项目,我使用 maven(主要用于 Java 项目的构建自动化工具。)和 IntelliJ IDEA 这是我的 war 项目的 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>
推荐阅读
- c# - 实体框架包管理器控制台问题
- amazon-web-services - 如何确认 AWS Cloud9 上的流程
- javascript - 调用函数比直接调用更快?
- r - 在数组中查找最近的匹配项 [R]
- java - 将函数从返回 long 更改为 BigInteger
- oauth-2.0 - 添加新权限导致:访问被拒绝。检查凭据并重试
- excel - 隐藏和取消隐藏 Excel 行
- java - 应用程序在我的真实手机中崩溃,但在 Android 模拟器上运行良好
- python - 如何在 tensorflow.contrib.slim 中为某些模型进行设备放置
- c# - 通过 Bamboo 根据环境动态更改 .Net Application 中的配置文件