2012-09-26 51 views
0

我在本地Maven倉庫取決於MINA在採用以下方式配置我自己的JAR:缺少神器org.apache.mina:米娜集成-OGNL:包:2.0.2

<!-- mina-core-2.0.2.jar --> 
<dependency> 
    <groupId>org.apache.mina</groupId> 
    <artifactId>mina-core</artifactId> 
    <version>2.0.2</version> 
</dependency> 

<dependency> 
    <groupId>org.apache.mina</groupId> 
    <artifactId>mina-integration-jmx</artifactId> 
    <version>2.0.2</version> 
</dependency> 

我寫這個希望Maven會像我的圖書館要求的那樣下載2.0.2版本的JAR。

但是2.0.2的工件被Eclipse認爲是「捆綁」。

mina-integration-jmx工件以如下方式

<dependency> 
    <groupId>${project.groupId}</groupId> 
    <artifactId>mina-integration-ognl</artifactId> 
    <version>${project.version}</version> 
    <type>bundle</type> 
</dependency> 

即它希望mina-integration-ognl是一個束取決於mina-integration-ognl

我在存儲庫中看到這個工件,並且看不出爲什麼它不能下載。

我的整個POM

這POM用於創建org.red5:red5神器:

<?xml version="1.0"?> 
<project> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>org.red5</groupId> 
    <artifactId>red5</artifactId> 
    <name>Red5 Library</name> 
    <version>1.0.0-RC1</version> 
    <description>Red5 Core Library</description> 
    <dependencies> 




<!-- com.springsource.slf4j.api-1.6.1.jar --> 
<dependency> 
    <groupId>org.slf4j</groupId> 
    <artifactId>slf4j-api</artifactId> 
    <version>1.6.1</version> 
</dependency> 

<!-- com.springsource.org.apache.xerces-2.9.1.jar --> 

<!-- mina-core-2.0.2.jar --> 
<dependency> 
    <groupId>org.apache.mina</groupId> 
    <artifactId>mina-core</artifactId> 
    <version>2.0.2</version> 
</dependency> 


<!-- commons-beanutils-1.8.2.jar --> 
<dependency> 
    <groupId>commons-beanutils</groupId> 
    <artifactId>commons-beanutils</artifactId> 
    <version>1.8.2</version> 
</dependency> 

<!-- ehcache-core-2.2.0.jar --> 
<dependency> 
    <groupId>net.sf.ehcache</groupId> 
    <artifactId>ehcache-core</artifactId> 
    <version>2.2.0</version> 
</dependency> 

<!-- com.springsource.org.apache.commons.lang-2.4.0.jar --> 
<dependency> 
    <groupId>commons-lang</groupId> 
    <artifactId>commons-lang</artifactId> 
    <version>2.4</version> 
</dependency> 

<!-- jaudiotagger-1.0.8.jar --> 
<dependency> 
    <groupId>org.jaudiotagger</groupId> 
    <artifactId>jaudiotagger</artifactId> 
    <version>1.0.8</version> 
</dependency> 

<!-- logback-classic-0.9.26.jar --> 
<dependency> 
    <groupId>ch.qos.logback</groupId> 
    <artifactId>logback-classic</artifactId> 
    <version>0.9.26</version> 
</dependency> 

<!-- logback-core-0.9.26.jar --> 
<dependency> 
    <groupId>ch.qos.logback</groupId> 
    <artifactId>logback-core</artifactId> 
    <version>0.9.26</version> 
</dependency> 

<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-context</artifactId> 
    <version>3.0.5.RELEASE</version> 
</dependency> 


<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-beans</artifactId> 
    <version>3.0.5.RELEASE</version> 
</dependency> 

<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-core</artifactId> 
    <version>3.0.5.RELEASE</version> 
</dependency> 

<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-web</artifactId> 
    <version>3.0.5.RELEASE</version> 
</dependency> 

<dependency> 
    <groupId>org.slf4j</groupId> 
    <artifactId>jul-to-slf4j</artifactId> 
    <version>1.6.1</version> 
</dependency> 

<!-- httpclient-3.1.0.jar --> 
<dependency> 
    <groupId>commons-httpclient</groupId> 
    <artifactId>commons-httpclient</artifactId> 
    <version>3.1</version> 
</dependency> 

<dependency> 
    <groupId>commons-codec</groupId> 
    <artifactId>commons-codec</artifactId> 
    <version>1.4</version> 
</dependency> 

<!-- bcprov-jdk16-145.jar --> 
<dependency> 
    <groupId>org.bouncycastle</groupId> 
    <artifactId>bcprov-jdk16</artifactId> 
    <version>1.45</version> 
</dependency> 

<!-- xmlrpc-2.0.1.jar --> 
<dependency> 
    <groupId>org.apache.ws.xmlrpc</groupId> 
    <artifactId>xmlrpc</artifactId> 
    <version>2.0.1</version> 
</dependency> 

<dependency> 
    <groupId>org.apache.mina</groupId> 
    <artifactId>mina-integration-jmx</artifactId> 
    <version>2.0.2</version> 
</dependency> 

<dependency> 
    <groupId>org.opensymphony.quartz</groupId> 
    <artifactId>quartz</artifactId> 
    <version>1.6.5</version> 
</dependency> 

<!-- com.springsource.org.codehaus.groovy-1.7.0.jar --> 
<dependency> 
    <groupId>org.codehaus.groovy</groupId> 
    <artifactId>groovy</artifactId> 
    <version>1.7.0</version> 
</dependency> 

<!-- jython-2.5.jar --> 
<dependency> 
    <groupId>org.python</groupId> 
    <artifactId>jython</artifactId> 
    <version>2.5.0</version> 
</dependency> 

</dependencies> 
</project> 

依賴關係,推導出與JarAnalyzer從red5.jar,然後red5.jar被安裝到本地存儲庫。

在我的Eclipse項目後來這件神器是指具有下列POM:

<dependencies> 
<dependency> 
    <groupId>cglib</groupId> 
    <artifactId>cglib</artifactId> 
    <version>2.2.2</version> 
</dependency> 
<dependency> 
    <groupId>org.slf4j</groupId> 
    <artifactId>slf4j-log4j12</artifactId> 
    <version>1.6.1</version> 
</dependency> 
<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-test</artifactId> 
    <version>3.0.5.RELEASE</version> 
</dependency> 
<dependency> 
    <groupId>org.red5</groupId> 
    <artifactId>red5</artifactId> 
    <version>1.0.0-RC1</version> 
</dependency> 
</dependencies> 
+1

你不是實際上是把神器'Mina的集成 - ognl'在你自己的POM文件中是你嗎?你可以粘貼你的整個POM.xml嗎? – ramsinb

+0

mina-integration-ognl pom是否指定了好的類型(bundle)? –

+0

@ramsinb我認爲它取決於來自存儲庫的'mina-integration-ognl',而不是來自我。 –

回答

0

另一個例子我也有我的POM中的一些缺少神器錯誤,包括你的「失蹤神器org.apache.mina:米娜集成-OGNL:包: 「使用mina-integration-jmx時。我不能肯定地說這將適用於您的情況,但如果您將下面的示例項目簽出到Eclipse中,則將我的標記放在我損壞的POM的末尾,可以修復這些錯誤。

http://svn.apache.org/repos/asf/mina/mina/branches/2.0/mina-example

這裏是構建標籤,我把我的POM結束。

<build> 
    <finalName>mina-game-server</finalName> 
    <sourceDirectory>src/main/java</sourceDirectory> 
    <!-- 控制資源文件的拷貝 
    <resources> 
     <resource> 
      <directory>src/main/resources</directory> 
      <targetPath>${project.build.directory}</targetPath> 
     </resource> 
    </resources> 
    --> 
    <plugins> 
     <!-- 設置源文件編碼方式 --> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <configuration> 
       <defaultLibBundleDir>lib</defaultLibBundleDir> 
       <source>1.7</source> 
       <target>1.7</target> 
       <encoding>UTF-8</encoding> 
      </configuration> 
     </plugin> 
     <!-- 打包jar文件時,配置manifest文件,加入lib包的jar依賴 --> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-jar-plugin</artifactId> 
      <configuration> 
       <archive> 
        <manifest> 
         <addClasspath>true</addClasspath> 
         <classpathPrefix>lib/</classpathPrefix> 
         <mainClass>com.example.bin.StartUp</mainClass> 
        </manifest> 
       </archive> 
      </configuration> 
     </plugin> 
     <!-- 拷貝依賴的jar包到lib目錄 --> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-dependency-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>copy</id> 
        <phase>package</phase> 
        <goals> 
         <goal>copy-dependencies</goal> 
        </goals> 
        <configuration> 
         <outputDirectory> 
          ${project.build.directory}/lib 
         </outputDirectory> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
     <!-- 解決資源文件的編碼問題 --> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-resources-plugin</artifactId> 
      <version>2.6</version> 
      <configuration> 
       <encoding>UTF-8</encoding> 
      </configuration> 
     </plugin> 
     <!-- 解決mina包maven配置文件報錯問題 --> 
     <plugin> 
      <groupId>org.apache.felix</groupId> 
      <artifactId>maven-bundle-plugin</artifactId> 
      <extensions>true</extensions> 
     </plugin> 
    </plugins> 
</build> 

我測試過這些例子,它們工作。

如果你有興趣在我的上半年我爲Mina的例子項目所作的POM,這裏是:

<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.shirong</groupId> 
<artifactId>mina-example</artifactId> 
<version>1.0.0</version> 

<packaging>jar</packaging> 
<name>Apache MINA Examples</name> 
<url>http://www.example.com</url> 
<dependencies> 

<dependency> 
    <groupId>junit</groupId> 
    <artifactId>junit</artifactId> 
    <version>4.10</version> 
    <scope>test</scope> 
</dependency> 

<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-context</artifactId> 
    <version>3.2.9.RELEASE</version> 
</dependency> 
<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-tx</artifactId> 
    <version>3.2.9.RELEASE</version> 
</dependency> 
<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-orm</artifactId> 
    <version>3.2.9.RELEASE</version> 
</dependency> 
<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-test</artifactId> 
    <version>3.2.9.RELEASE</version> 
</dependency> 
<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-aspects</artifactId> 
    <version>3.2.9.RELEASE</version> 
</dependency> 


<dependency> 
    <groupId>org.apache.mina</groupId> 
    <artifactId>mina-core</artifactId> 
    <version>2.0.7</version> 
</dependency> 


<dependency> 
    <groupId>org.apache.mina</groupId> 
    <artifactId>mina-integration-jmx</artifactId> 
    <version>2.0.7</version> 
</dependency> 

<dependency> 
    <groupId>org.apache.mina</groupId> 
    <artifactId>mina-integration-xbean</artifactId> 
    <version>2.0.7</version> 
</dependency> 

<dependency> 
    <groupId>org.apache.mina</groupId> 
    <artifactId>mina-integration-beans</artifactId> 
    <version>2.0.7</version> 
    <type>bundle</type> 
</dependency> 

<dependency> 
    <groupId>org.apache.mina</groupId> 
    <artifactId>mina-integration-ognl</artifactId> 
    <version>2.0.7</version> 
</dependency> 

<dependency> 
    <groupId>org.apache.mina</groupId> 
    <artifactId>mina-statemachine</artifactId> 
    <version>2.0.7</version> 
</dependency> 

<dependency> 
    <groupId>org.apache.mina</groupId> 
    <artifactId>mina-filter-compression</artifactId> 
    <version>2.0.7</version> 
</dependency> 



<dependency> 
    <groupId>org.apache.mina</groupId> 
    <artifactId>mina-transport-apr</artifactId> 
    <version>2.0.7</version> 
</dependency> 

<dependency> 
    <groupId>jmock</groupId> 
    <artifactId>jmock</artifactId> 
    <version>1.2.0</version> 
    <scope>test</scope> 
</dependency> 



<dependency> 
    <groupId>org.slf4j</groupId> 
    <artifactId>jcl-over-slf4j</artifactId> 
    <version>1.6.6</version> 
</dependency> 

</dependencies> 

GL