2014-04-23 63 views
1

我從GitHub下載風暴首發: https://github.com/apache/incubator-storm/tree/master/examples/storm-starter的Apache 9.2風暴中缺少風暴起動

有一個丟失的依賴:

<dependency> 
    <groupId>org.apache.storm</groupId> 
    <artifactId>storm-core</artifactId> 
    <version>0.9.2-incubating-SNAPSHOT</version> 
    <!-- keep storm out of the jar-with-dependencies --> 
    <scope>provided</scope> 
</dependency> 

隨着0.9.1-培養meven解決的依賴。 我可以在風暴起動器示例中使用它嗎? 有不兼容性?

回答

0

嘗試以下依賴

<dependency> 
<groupId>storm</groupId> 
<artifactId>storm</artifactId> 
<version>0.9.1</version> 
</dependency> 
+0

嗨艾米特。 對不起,但爲什麼0.8.2而不是0.9.1孵化? –

+0

對不起@AndreaZonzin我複製依賴關係並粘貼它,我編輯答案,希望它的工作給你。 –

+0

隨着0.9.1 maven解決了依賴。但是,當我編譯與maven它會導致 java.lang.ClassNotFoundException:org.apache.zookeeper.server.NIOServerCnxn $工廠 –

2

這是我如何解決了這個問題。

首先,你有使用版本0.9.1孵化(與「0.9.2孵化-SNAPSHOT」maven不能解決依賴)。

其次,使用eclipse,它添加org.eclipse.m2e插件。 通知評論:

<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--> 

這不是很真實 看來,標籤

<versionRange>[1.3.18,)</versionRange> 

導致的版本的插件1.3.18 「的Clojure - Maven的插件」下載。 這會導致org.apache.zookeeper.server.NIOServerCnxn $ Factory的ClassNotFound異常。

爲了解決這個問題,你可以強制clojure-maven-plugin的版本1.3.8。 或者將org.eclipse.m2e插件的版本範圍設置爲[1.3.8,)。

這裏我工作的pom.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<!-- 
Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements. See the NOTICE file distributed with 
this work for additional information regarding copyright ownership. 
The ASF licenses this file to You under the Apache License, Version 2.0 
(the "License"); you may not use this file except in compliance with 
the License. You may obtain a copy of the License at 

    http://www.apache.org/licenses/LICENSE-2.0 

Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
See the License for the specific language governing permissions and 
limitations under the License. 
--> 
<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/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <parent> 
     <artifactId>storm</artifactId> 
     <groupId>org.apache.storm</groupId> 
     <version>0.9.1-incubating</version> 
     <relativePath>../../pom.xml</relativePath> 
    </parent> 

    <groupId>org.apache.storm</groupId> 
    <artifactId>storm-starter</artifactId> 
    <packaging>jar</packaging> 

    <name>storm-starter</name> 


    <dependencies> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>4.11</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.testng</groupId> 
     <artifactId>testng</artifactId> 
     <version>6.8.5</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.mockito</groupId> 
     <artifactId>mockito-all</artifactId> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.easytesting</groupId> 
     <artifactId>fest-assert-core</artifactId> 
     <version>2.0M8</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.jmock</groupId> 
     <artifactId>jmock</artifactId> 
     <version>2.6.0</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.storm</groupId> 
     <artifactId>storm-core</artifactId> 
     <version>${project.version}</version> 
     <!-- keep storm out of the jar-with-dependencies --> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>commons-collections</groupId> 
     <artifactId>commons-collections</artifactId> 
     <version>3.2.1</version> 
    </dependency> 
    <dependency> 
     <groupId>com.google.guava</groupId> 
     <artifactId>guava</artifactId> 
    </dependency> 
    </dependencies> 

    <build> 
    <sourceDirectory>src/jvm</sourceDirectory> 
    <testSourceDirectory>test/jvm</testSourceDirectory> 
    <resources> 
     <resource> 
     <directory>${basedir}/multilang</directory> 
     </resource> 
    </resources> 

    <plugins> 
     <!-- 
     Bind the maven-assembly-plugin to the package phase 
     this will create a jar file without the storm dependencies 
     suitable for deployment to a cluster. 
     --> 
     <plugin> 
     <artifactId>maven-assembly-plugin</artifactId> 
     <configuration> 
      <descriptorRefs> 
      <descriptorRef>jar-with-dependencies</descriptorRef> 
      </descriptorRefs> 
      <archive> 
      <manifest> 
       <mainClass></mainClass> 
      </manifest> 
      </archive> 
     </configuration> 
     <executions> 
      <execution> 
      <id>make-assembly</id> 
      <phase>package</phase> 
      <goals> 
       <goal>single</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 

     <plugin> 
     <groupId>com.theoryinpractise</groupId> 
     <artifactId>clojure-maven-plugin</artifactId> 
     <version>1.3.8</version> 
     <extensions>true</extensions> 
     <configuration> 
      <sourceDirectories> 
      <sourceDirectory>src/clj</sourceDirectory> 
      </sourceDirectories> 
     </configuration> 
     <executions> 
      <execution> 
      <id>compile</id> 
      <phase>compile</phase> 
      <goals> 
       <goal>compile</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 

     <plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>exec-maven-plugin</artifactId> 
     <version>1.2.1</version> 
     <executions> 
      <execution> 
      <goals> 
       <goal>exec</goal> 
      </goals> 
      </execution> 
     </executions> 
     <configuration> 
      <executable>java</executable> 
      <includeProjectDependencies>true</includeProjectDependencies> 
      <includePluginDependencies>false</includePluginDependencies> 
      <classpathScope>compile</classpathScope> 
      <mainClass>${storm.topology}</mainClass> 
     </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> 
    <pluginManagement> 
     <plugins> 
      <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--> 
      <plugin> 
       <groupId>org.eclipse.m2e</groupId> 
       <artifactId>lifecycle-mapping</artifactId> 
       <version>1.0.0</version> 
       <configuration> 
        <lifecycleMappingMetadata> 
         <pluginExecutions> 
          <pluginExecution> 
           <pluginExecutionFilter> 
            <groupId> 
             com.theoryinpractise 
            </groupId> 
            <artifactId> 
             clojure-maven-plugin 
            </artifactId> 
            <versionRange> 
             [1.3.8,) 
            </versionRange> 
            <goals> 
             <goal>compile</goal> 
            </goals> 
           </pluginExecutionFilter> 
           <action> 
            <ignore></ignore> 
           </action> 
          </pluginExecution> 
         </pluginExecutions> 
        </lifecycleMappingMetadata> 
       </configuration> 
      </plugin> 
     </plugins> 
    </pluginManagement> 
    </build> 
</project>