我有两个项目,每个项目都有自己的pom文件。
rar项目已编译,打包,然后安装到本地maven仓库。 rar缩短的pom如下:
<?xml version="1.0" encoding="UTF-8"?>
<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>org.csir.iptv.connector</groupId>
<artifactId>MpsZmqConnector</artifactId>
<packaging>rar</packaging>
<version>0.0.1-SNAPSHOT</version>
<url>http://repository.jboss.org</url>
<properties>
<version.org.jboss.ironjacamar>1.2.7.Final</version.org.jboss.ironjacamar>
</properties>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-rar-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>package</id>
<goals>
<goal>rar</goal>
</goals>
<configuration>
<includes>
<include>**/META-INF/*</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
第二个项目的pom如下:
<?xml version="1.0" encoding="UTF-8"?>
<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>org.csir.iptv</groupId>
<artifactId>MpsService</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.csir.iptv.connector</groupId>
<artifactId>MpsZmqConnector</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
<type>rar</type>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
</plugin>
</plugins>
</build>
</project>
在jar项目上运行mvn compile
会导致:
[错误]无法执行目标org.apache.maven.plugins:maven-compiler-plugin:2.5.1:项目MpsService上的compile(default-compile):编译失败:编译失败: [ERROR] /home/rglobisch/projects/Refactor/MpsService/src/main/java/org/csir/iptv/domain/ejb/communication/CommunicationService.java:[46,30]错误:找不到符号 [错误]符号:类RAMQConnection [错误]位置:包org.csir.iptv.connector
但是,如果我将rar中的jar提取到本地maven repo中,那么jar项目的编译就会成功。
我做错了什么或错过了什么?
更新1: 回应@Jens
第一个项目生成一个安装在本地maven仓库中的rar。 我如何(无需从rar手动提取jar)将jar项目设置为依赖于rar内的jar?
也许某些上下文会有所帮助:我试图用maven自动化现有eclipse项目的构建过程。我需要编译并生成各种rar,jar和wars,然后将其存档到将部署到JBoss服务器的ear项目中。