【发布时间】:2016-07-02 18:15:05
【问题描述】:
由于here 报告的问题,我在非maven mule 项目中使用了3.3.1 连接器版本,并且运行良好。
但是,我想在 maven mule 项目中添加 redis。但是,redis docs 只给了我 2 个选项:Release 或 Latest 版本。两者都导致报告的问题above。
我曾尝试将版本更改为 3.3.1 或 3.3.2 但当我尝试启动项目时,出现以下错误:
未能在项目单点登录上执行目标:无法解析项目 br.com.xpto:single-sign-on:mule:1.0.0-SNAPSHOT 的依赖项:无法在 org.mule 收集依赖项。模块:mule-module-redis:jar:3.3.2 -> org.mule.tools.devkit:mule-devkit-annotations:jar:3.3.1 -> org.mule.modules:mule-module-annotations:jar: 3.3.0 -> org.mule:mule-core:jar:3.3.0 -> javax.activation:activation:jar:1.1-osgi: 无法读取 javax.activation:activation:jar:1.1-osgi 的工件描述符:无法将工件 javax.activation:activation:pom:1.1-osgi 从/向 codehaus-snaphosts (http://snapshots.repository.codehaus.org/) 传输:snapshots.repository.codehaus.org
问题:有谁知道如何在不发布或最新版本的情况下在 maven 项目中添加 redis 依赖项?
更新
为了帮助大家理解我的问题,我将在下面添加我的 pom.xml
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>xpto</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>mule</packaging>
<name>Mule xpto Application</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<mule.version>3.7.0</mule.version>
<mule.tools.version>1.1</mule.tools.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>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>project</descriptorRef>
</descriptorRefs>
</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>org.mule.tools</groupId>
<artifactId>maven-mule-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<excludeMuleDependencies>false</excludeMuleDependencies>
<inclusions>
<inclusion>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-redis</artifactId>
</inclusion>
</inclusions>
</configuration>
</plugin>
</plugins>
</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-http</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-redis</artifactId>
<version>3.3.2</version>
</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>
<repository>
<id>mulesoft-snapshots</id>
<name>MuleSoft Snapshot Repository</name>
<url>http://repository.mulesoft.org/snapshots/</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>
所以上面的pom.xml的重点是:
1- 存储库
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>http://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-snapshots</id>
<name>MuleSoft Snapshot Repository</name>
<url>http://repository.mulesoft.org/snapshots/</url>
<layout>default</layout>
</repository>
2-依赖关系
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-redis</artifactId>
<version>3.3.2</version>
</dependency>
当我尝试启动应用程序时,出现以下错误
构建失败 [错误] 未能在项目 xpto 上执行目标:无法解决 项目 com.mycompany:xpto:mule:1.0.0-SNAPSHOT 的依赖项: 无法在 org.mule.modules:mule-module-redis:jar:3.3.2 收集依赖项 -> org.mule.tools.devkit:mule-devkit-annotations:jar:3.3.1 -> org.mule.modules:mule-module-annotations:jar:3.3.0 -> org.mule:mule-core:jar:3.3.0 -> javax.activation:activation:jar:1.1-osgi: 无法读取工件描述符 javax.activation:activation:jar:1.1-osgi: 无法传输工件 javax.activation:activation:pom:1.1-osgi 从/到 codehaus-snaphosts (http://snapshots.repository.codehaus.org/): snapshots.repository.codehaus.org -> [帮助 1]
更新 2
执行命令 mvn dependency:tree -Dincludes=javax.activation 我得到以下输出:
下载:http://snapshots.repository.codehaus.org/org/apache/geronimo/specs/geronimo-j2ee-connector_1.5_spec/1.1-osgi/geronimo-j2ee-connector_1.5_spec-1.1-osgi.pom 下载:http://repository.codehaus.org/org/apache/geronimo/specs/geronimo-j2ee-connector_1.5_spec/1.1-osgi/geronimo-j2ee-connector_1.5_spec-1.1-osgi.pom 下载:http://repository.codehaus.org/org/apache/geronimo/specs/geronimo-j2ee-connector_1.5_spec/1.1-osgi/geronimo-j2ee-connector_1.5_spec-1.1-osgi.pom 构建失败 [错误] 无法在项目 xpto 上执行目标:无法解析项目 com.mycompany:xpto:mule:1.0.0-SNAPSHOT 的依赖项:无法在 org.mule.modules:mule-module-redis:jar 收集依赖项: 3.3.2 -> org.mule.tools.devkit:mule-devkit-annotations:jar:3.3.1 -> org.mule.modules:mule-module-annotations:jar:3.3.0 -> org.mule:mule -core:jar:3.3.0 -> org.apache.geronimo.specs:geronimo-j2ee-connector_1.5_spec:jar:1.1-osgi:无法读取 org.apache.geronimo.specs:geronimo-j2ee- 的工件描述符connector_1.5_spec:jar:1.1-osgi: 无法从/到 codehaus-snaphosts (http://snapshots.repository.codehaus.org/) 传输工件 org.apache.geronimo.specs:geronimo-j2ee-connector_1.5_spec:pom:1.1-osgi: snapshots.repository .codehaus.org -> [帮助 1]
【问题讨论】:
-
codehaus.org 上的存储库已不存在,他们已于 2015 年 3 月关闭了那里的大门......所以存储库定义完全错误......
-
我遵循了 redis-connector 的文档,当我将版本设置为 RELEASE 或 LATEST 时,不会发生此错误。但是,我想使用以前的版本,例如 3.3.1。当我更改版本依赖项时,我收到此错误。我想知道我应该怎么做才能实现这一目标。
-
不要使用 RELEASE 或 LATEST 你应该定义你需要的版本..例如 3.3.1