【问题标题】:Apache Tomee 7.0.2 - Maven compilation error for microservicesApache Tomee 7.0.2 - 微服务的 Maven 编译错误
【发布时间】:2019-09-15 20:23:17
【问题描述】:

我正在使用 Apache Tomee 7.0.2 微配置文件并尝试了解有关微服务的更多信息。教程链接之一位于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>

在此不胜感激。
谢谢。

【问题讨论】:

    标签: tomcat microservices apache-tomee tomee-7 microprofile


    【解决方案1】:

    你正在运行什么 Maven 命令?试试mvn clean package

    还需要将&lt;artifactId&gt;javaee-api&lt;/artifactId&gt; 标记为provided 范围,并且可能根本不应该包含jackson :)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-10-28
      • 2015-08-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-28
      • 1970-01-01
      相关资源
      最近更新 更多