无法构建maven mule应用程序

问题描述 投票:0回答:1

当我通过 gitlab 部署时,出现此错误

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.0:compile (default-compile) on project project-1.0.0: Compilation failure: Compilation failure:
[ERROR] /builds/test2/project-1.0.0/src/main/java/not1.java:[116,3] class not1 is already defined in package unnamed package
[ERROR] /builds/test2/project-1.0.0/src/main/java/notmess.java:[100,70] package priority does not exist
[ERROR] /builds/test2/project-1.0.0/src/main/java/gen-mess.java:[13,38] incompatible types: int cannot be converted to java.lang.String
[ERROR] //builds/test2/project-1.0.0/src/main/java/updatemess55.java:[44,103] incompatible types: long cannot be converted to java.lang.String
[ERROR] /builds/test2/project-1.0.0/src/main/java/subsservice-mess12.java:[50,110] incompatible types: long cannot be converted to java.lang.String

POM.xml:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mess</groupId>
    <artifactId>message-app54</artifactId>
    <version>1.0</version>
    <packaging>mule</packaging>
    <name>Mule 43 Application</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <mule.version>3.8.0</mule.version>
        <mule.tools.version>1.2</mule.tools.version>
    <munit.version>1.3.1</munit.version>
    <mule.munit.support.version>3.8.2</mule.munit.support.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.mule.tools.maven</groupId>
                <artifactId>mule-app-maven-plugin</artifactId>
                <version>${mule.tools.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <copyToAppsDirectory>true</copyToAppsDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <id>add-resource</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>add-resource</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>src/main/app/</directory>
                                </resource>
                                <resource>
                                    <directory>mappings/</directory>
                                </resource>
                            <resource>
                                    <directory>src/main/api/</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        <plugin>
                <groupId>com.mulesoft.munit.tools</groupId>
                <artifactId>munit-maven-plugin</artifactId>
                <version>${munit.version}</version>
                <executions>
                    <execution>
                        <id>test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <coverage>
                        <runCoverage>true</runCoverage>
                        <formats>
                            <format>html</format>
                        </formats>
                    </coverage>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    <testResources>
            <testResource>
                <directory>src/test/munit</directory>
            </testResource>
        <testResource>
                <directory>src/test/resources</directory>
            </testResource>
        </testResources>
    </build>

    <!-- Mule Dependencies -->
    <dependencies>
        <!-- Xml configuration -->
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-spring-config</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- Mule Transports -->
        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-file</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-http</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-jdbc</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-jms</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-vm</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- Mule Modules -->
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-scripting</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-xml</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- for testing -->
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-tests-functional</artifactId>
            <version>${mule.version}</version>
            <scope>test</scope>
        </dependency>
    <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-apikit</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
    <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <version>3.2.2</version>
            <scope>provided</scope>
        </dependency>
    <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-db</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
    <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.20</version>
        </dependency>
    <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-json</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
    <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-email</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
    <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-http</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
    <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-jersey</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
    <groupId>com.squareup.okhttp</groupId>
    <artifactId>okhttp</artifactId>
    <version>2.7.5</version>
</dependency>
    <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20160810</version>
        </dependency>
            <dependency>
            <groupId>com.google.api-client</groupId>
            <artifactId>google-api-client</artifactId>
            <version>1.30.9</version>
        </dependency>
        <dependency>
          <groupId>com.google.auth</groupId>
          <artifactId>google-auth-library-oauth2-http</artifactId>
          <version>0.17.1</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.6</version>
        </dependency>
        <dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava-jdk5</artifactId>
    <version>17.0</version>
</dependency>
    <dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>23.0</version>
</dependency>
    <dependency>
            <groupId>com.mulesoft.munit</groupId>
            <artifactId>mule-munit-support</artifactId>
            <version>${mule.munit.support.version}</version>
            <scope>test</scope>
        </dependency>
    <dependency>
            <groupId>com.mulesoft.munit</groupId>
            <artifactId>munit-runner</artifactId>
            <version>${munit.version}</version>
            <scope>test</scope>
        </dependency>
    <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-quartz</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
    <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-jetty</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <repositories>
          <repository>
            <id>Central</id>
            <name>Central</name>
            <url>http://repo1.maven.org/maven2/</url>
            <layout>default</layout>
        </repository>
        <repository>
            <id>mulesoft-releases</id>
            <name>MuleSoft Releases Repository</name>
            <url>http://repository.mulesoft.org/releases/</url>
            <layout>default</layout>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>mulesoft-release</id>
            <name>mulesoft release repository</name>
            <layout>default</layout>
            <url>http://repository.mulesoft.org/releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

</project>

我尝试将 maven-compiler-plugin 版本编辑并编辑为旧版本,但这并不能解决问题

我还使用 gitlab ci/cd 在 mule 上运行 3.3.9-jdk8。这是一个比较旧的项目,它是手动直接在服务器上应用更改的,所以我想集成到 gitlab 中,这样它就可以通过自动 ci/cd 运行良好

谢谢

java mule gitlab-ci maven-3 mule-esb
1个回答
1
投票

问题出在项目的 Java 代码中,正如错误消息所述。修复这些问题,它应该可以编译。它与 Mule 或 Maven 无关。它们是 Java 编程错误。

这个项目肯定是一团糟,这是肯定的。没有包的 Java 文件或不正确的目录以及基本的转换错误是一个很好的提示。 Maven 的描述说它是一个 Mule 4.3 应用程序,但它是一个 Mule 3.8 项目。而且这些文件的名称甚至不遵循 Java 类的约定。 com.确实一团糟。

© www.soinside.com 2019 - 2024. All rights reserved.