MuleSoft Java 自定义连接器构建错误 jdeps 命令

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

我正在尝试构建 JAVA 17 版本支持的 mulesoft json 记录器,当我尝试发布到交换时出现以下错误

Failed to execute goal org.apache.maven.plugins:maven-jdeps-plugin:3.1.2:jdkinternals (default) on project json-logger: Unable to find jdeps command: The environment variable JAVA_HOME is not correctly set

我在我的 Mac 机器上

/usr/libexec/java_home
/Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home

which java
/usr/bin/java

知道这里缺少什么吗..

这是 pom.xml (我从 MuleSoft 支持团队获得了这个项目)。所做的所有更改都是更新 pom 并删除 AMQP、Broker Destinations

<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>json-logger</artifactId>
<version>3.0.0</version>
<packaging>mule-extension</packaging>
<name>JSON Logger - Mule 4.6+</name>

<parent>
    <groupId>org.mule.extensions</groupId>
    <artifactId>mule-modules-parent</artifactId>
    <version>1.6.0</version>
</parent>

<description>Mule modules that augment the core Mule functionality through the Mule Extension API</description>
<properties>
    <mtf.javaopts/>
    <mule.sdk.api.version>0.7.0</mule.sdk.api.version>
    <jackson.databind.version>2.10.3</jackson.databind.version>
    <common.lang.version>2.6</common.lang.version>
    <common.beanutils.version>1.9.4</common.beanutils.version>
    <joda.time.version>2.10.5</joda.time.version>
    <lmax.disruptor.version>3.4.2</lmax.disruptor.version>
    <json.path.version>2.4.0</json.path.version>
    <min.mule.version>4.6.0</min.mule.version>
    <munit.version>3.1.0</munit.version>
    <munit.extensions.maven.plugin.version>1.2.0</munit.extensions.maven.plugin.version>
    <mule.extensions.maven.plugin.version>1.6.0-rc1</mule.extensions.maven.plugin.version>

</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jdeps-plugin</artifactId>
            <version>3.1.2</version>
            <executions>
                <execution>
                    <goals>
                        <goal>jdkinternals</goal>
                        <goal>test-jdkinternals</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <failOnWarning>true</failOnWarning>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-install-plugin</artifactId>
            <version>2.5.2</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.8.2</version>
        </plugin>
        <plugin>
            <groupId>org.jsonschema2pojo</groupId>
            <artifactId>jsonschema2pojo-maven-plugin</artifactId>
            <version>0.4.35</version>
            <dependencies>
                <dependency>
                    <groupId>io.github.mulesoft-consulting</groupId>
                    <artifactId>jsonschema2pojo-mule-annotations</artifactId>
                    <version>1.2.0</version>
                    <scope>compile</scope>
                </dependency>
            </dependencies>
            <configuration>
                <customAnnotator>org.mule.custom.annotation.utils.CustomMuleAnnotator</customAnnotator>
                <sourceDirectory>${basedir}/src/main/resources/schema</sourceDirectory>
                <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
                <targetPackage>org.mule.extension.jsonlogger.api.pojos</targetPackage>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </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>
                <runtimeConfiguration>
                    <discoverRuntimes>
                        <minMuleVersion>${min.mule.version}</minMuleVersion>
                        <includeSnapshots>false</includeSnapshots>
                        <product>EE</product>
                    </discoverRuntimes>
                </runtimeConfiguration>
            </configuration>
        </plugin>
    </plugins>
</build>

<distributionManagement>
    <!-- Target Anypoint Organization Repository -->
    <repository>
        <id>Exchange2</id>
        <name>Exchange2 Repository</name>
        <!-- Update to US Based if your customer is in the US Control Plane -->
        <url>https://anypoint.mulesoft.com/api/v2/organizations/${project.groupId}/maven</url>
        <layout>default</layout>
    </repository>
</distributionManagement>

<dependencies>
    <dependency>
        <groupId>org.mule.sdk</groupId>
        <artifactId>mule-sdk-api</artifactId>
        <version>${mule.sdk.api.version}</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>${jackson.databind.version}</version>
    </dependency>
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>${common.lang.version}</version>
    </dependency>
    <dependency>
        <groupId>commons-beanutils</groupId>
        <artifactId>commons-beanutils</artifactId>
        <version>${common.beanutils.version}</version>
    </dependency>
    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>${joda.time.version}</version>
    </dependency>
    <dependency>
        <groupId>com.jayway.jsonpath</groupId>
        <artifactId>json-path</artifactId>
        <version>${json.path.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>com.lmax</groupId>
        <artifactId>disruptor</artifactId>
        <version>${lmax.disruptor.version}</version>
    </dependency>
    <dependency>
        <groupId>com.mulesoft.munit</groupId>
        <artifactId>munit-extensions-maven-plugin</artifactId>
        <version>${munit.extensions.maven.plugin.version}</version>
    </dependency>
</dependencies>

<repositories>
    <repository>
        <id>Exchange2</id>
        <name>Exchange2 Repository</name>
        <!-- Update if on US Control Plane -->
        <url>https://anypoint.mulesoft.com/api/v3/organizations/${project.groupId}/maven</url>
        <layout>default</layout>
    </repository>
    <repository>
        <id>anypoint-exchange-v3</id>
        <name>Anypoint Exchange V3</name>
        <url>https://maven.anypoint.mulesoft.com/api/v3/maven</url>
        <layout>default</layout>
    </repository>
</repositories>
mule mulesoft java-17
1个回答
0
投票

我在使用 Maven 在 Mac 上构建自定义连接器时遇到了类似的问题。我安装了 temurin-8,并在运行 maven 之前手动设置了

JAVA_HOME
环境变量。

➜  mule-lettuce-redis-connector git:(main) ✗ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home

我像这样手动设置:

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`; java -version
© www.soinside.com 2019 - 2024. All rights reserved.