简体   繁体   中英

Failed to build maven mule application

When i deploy via gitlab i got this error

[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>

I have tried to edit and edit maven-compiler-plugin version to older one but that doesn't solve the problem

Also i have run on 3.3.9-jdk8 on mule with gitlab ci/cd. This is little older project and it was manually having changes applied on the server directly, so i wanted to integrate in gitlab so it will run good with automatic ci/cd

Thanks

The problem is in the Java code of the project as the error messages say. Fix those and it should comoile. It has nothing to do with Mule nor Maven. They are Java programming errors.

The project is certainly a mess, that's for sure. The Java files without packages or an incorrect directory, and the basic conversion errors are a good hint. The description of the Maven says it is a Mule 4.3 application but it is a Mule 3.8 project. And the names of the files don't even follow Java convention for classes. com.mess indeed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM