1

我正在使用 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>

将不胜感激这里的任何帮助。
谢谢。

4

1 回答 1

1

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

<artifactId>javaee-api</artifactId>需要标记为provided范围,并且可能根本不应该包括杰克逊 :)

于 2019-09-20T15:14:13.410 回答