gpt4 book ai didi

tomcat - Apache Tomee 7.0.2 - 微服务的 Maven 编译错误

转载 作者:行者123 更新时间:2023-11-28 22:15:29 25 4
gpt4 key购买 nike

我正在使用 Apache Tomee 7.0.2 microprofile 并尝试了解有关微服务的更多信息。教程链接之一可在 https://www.javacodegeeks.com/2017/03/microservices-series-microprofile-apache-tomee.html 上找到.

使用上面链接中的示例,我在 Maven 打包阶段遇到以下错误。

[INFO] --- tomee-maven-plugin:7.0.1:exec (default-cli) @ Microservice ---    
[INFO] TomEE was unzipped in '/home/yapkm01/Java/jakartaEE/Workspace/Microservices/target/apache-tomee'
[INFO] Removed not mandatory default webapps
[WARNING] '/home/yapkm01/Java/jakartaEE/Workspace/Microservices/target/tomeeweb.jar' doesn't exist, ignoring (maybe run mvn package before this plugin)
[INFO] Zipping Custom TomEE Distribution
[INFO] TomEE will run in development mode
[INFO] Attaching Exec TomEE binary
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.644 s
[INFO] Finished at: 2019-09-15T16:13:58-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomee.maven:tomee-maven-plugin:7.0.1:exec (default-cli) on project Microservice: Execution default-cli of goal org.apache.tomee.maven:tomee-maven-plugin:7.0.1:exec failed: For artifact {io.microservices.tutorial:Microservice:0.0.1-SNAPSHOT:jar}: An attached artifact must have a different ID than its corresponding main artifact. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] h

我不太明白错误信息:

[ERROR] Failed to execute goal org.apache.tomee.maven:tomee-maven-plugin:7.0.1:exec (default-cli) on project Microservice: Execution default-cli of goal org.apache.tomee.maven:tomee-maven-plugin:7.0.1:exec failed: For artifact {io.microservices.tutorial:Microservice:0.0.1-SNAPSHOT:jar}: An attached artifact must have a different ID than its corresponding main artifact. -> [Help 1]

这是 pom.xml。

<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>
<groupId>io.microservices.tutorial</groupId>
<artifactId>Microservice</artifactId>
<version>0.0.1-SNAPSHOT</version>

<properties>
<java.version>1.10</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.tomee</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.7</version>
</dependency>
</dependencies>

<build>
<finalName>tomeeweb</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomee.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
<version>7.0.1</version>
<configuration>
<tomeeClassifier>webprofile</tomeeClassifier>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

在此感谢任何帮助。
谢谢。

最佳答案

您正在运行什么 maven 命令?尝试 mvn clean package

还有 <artifactId>javaee-api</artifactId>需要标记为provided范围, jackson 根本不应该包括在内:)

关于tomcat - Apache Tomee 7.0.2 - 微服务的 Maven 编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57947927/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com