2017-02-04 75 views
0

我下載了RavenDB Java客戶端3.2.1罐子從here,在Ecplise創建了一個新的Java項目,增加了罐子引用列表,然後帶着這三條線RavenDB Java客戶端缺少StringUtils的

IDocumentStore store = new DocumentStore(ravenDbUrl, "todo-db"); 
store.initialize(); 
store.executeIndex(new TodoByTitleIndex()); 

here,用我的特定於db的名稱替換了這些值,並期望從db獲得一些生命跡象。相反,我得到「Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils」。 我必須承認,自從我完成Java之後已經有一段時間了,但是這肯定不會錯過顯而易見的東西,是嗎?! 我也包含了commons-lang3-3.5.jar文件,但它沒有考慮到這一點。你能否指點我正確的方向?

謝謝!

+3

這些:http://i.imgur.com/SmjxBNr.png都依賴requred通過RavenDB Java客戶端3.2.1。很少幾個。你應該使用Maven(或類似的依賴管理器)並讓它爲你處理,否則你會發瘋。謝謝,Slanec, –

+0

。我希望這將是一個快速的練習,但似乎我需要回去熟悉Maven。或者,相反 - Maven和Ecplise二重唱。 –

回答

0

將「官方」pom添加到我的Eclipse項目中,使其編譯並運行。 爲了記錄在案,這裏的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/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <parent> 
    <groupId>net.ravendb</groupId> 
    <artifactId>ravendb-parent</artifactId> 
    <version>3.2.1</version> 
    </parent> 

    <artifactId>ravendb-client</artifactId> 
    <name>RavenDB Java Client</name> 

    <properties> 
    <queryDsl.version>3.1.1</queryDsl.version> 
    </properties> 

    <dependencies> 
    <dependency> 
     <groupId>com.mysema.querydsl</groupId> 
     <artifactId>querydsl-apt</artifactId> 
     <version>${queryDsl.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>commons-codec</groupId> 
     <artifactId>commons-codec</artifactId> 
     <version>1.7</version> 
    </dependency> 
    <dependency> 
     <groupId>commons-lang</groupId> 
     <artifactId>commons-lang</artifactId> 
     <version>2.6</version> 
    </dependency> 
    <dependency> 
     <groupId>commons-io</groupId> 
     <artifactId>commons-io</artifactId> 
     <version>1.3.2</version> 
    </dependency> 
    <dependency> 
     <groupId>commons-beanutils</groupId> 
     <artifactId>commons-beanutils</artifactId> 
     <version>1.8.3</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.httpcomponents</groupId> 
     <artifactId>httpclient</artifactId> 
     <version>4.3</version> 
    </dependency> 
    <dependency> 
     <groupId>org.codehaus.jackson</groupId> 
     <artifactId>jackson-mapper-asl</artifactId> 
     <version>1.9.12</version> 
    </dependency> 
    <dependency> 
     <groupId>de.undercouch</groupId> 
     <artifactId>bson4jackson</artifactId> 
     <version>1.3.0</version> 
    </dependency> 

    <!-- test deps --> 
    <dependency> 
     <groupId>com.mysema.querydsl</groupId> 
     <artifactId>querydsl-collections</artifactId> 
     <version>${queryDsl.version}</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>4.11</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.reflections</groupId> 
     <artifactId>reflections</artifactId> 
     <version>0.9.9-RC1</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.mockito</groupId> 
     <artifactId>mockito-all</artifactId> 
     <version>1.8.4</version> 
     <scope>test</scope> 
    </dependency> 
    </dependencies> 

    <build> 
    <plugins> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <version>2.5</version> 
     <configuration> 
      <source>1.7</source> 
      <target>1.7</target> 
      <encoding>UTF-8</encoding> 
     </configuration> 
     </plugin> 
     <plugin> 
     <groupId>com.mysema.maven</groupId> 
     <artifactId>apt-maven-plugin</artifactId> 
     <version>1.1.1</version> 
     <executions> 
      <execution> 
      <id>querydsl-test</id> 
      <goals> 
       <goal>test-process</goal> 
      </goals> 
      <configuration> 
       <outputDirectory>target/generated-test-sources/java</outputDirectory> 
       <processor>net.ravendb.querydsl.RavenDBAnnotationProcessor</processor> 
       <options> 
       <querydsl.entityAccessors>true</querydsl.entityAccessors> 
       </options> 
      </configuration> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-jar-plugin</artifactId> 
     <version>2.4</version> 
     <configuration> 
      <archive> 
      <manifestEntries> 
       <Source-Hash>${sourceHash}</Source-Hash> 
      </manifestEntries> 
      </archive> 
     </configuration> 
     </plugin> 
     <plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>versions-maven-plugin</artifactId> 
     <!-- version 2.2 has bug: https://github.com/mojohaus/versions-maven-plugin/issues/51 --> 
     <version>2.1</version> 
     </plugin> 
    </plugins> 
    </build> 
    <profiles> 

    <profile> 
     <id>pack</id> 
     <build> 
     <plugins> 
     <plugin> 
      <artifactId>maven-assembly-plugin</artifactId> 
      <version>2.4</version> 
      <configuration> 
       <descriptors> 
       <descriptor>src/main/assembly/dist.xml</descriptor> 
       </descriptors> 
       <attach>false</attach> 
      </configuration> 
      <executions> 
       <execution> 
       <id>make-assembly</id> 
       <phase>package</phase> 
       <goals> 
        <goal>single</goal> 
       </goals> 
       </execution> 
      </executions> 
      </plugin> 
     </plugins> 
     </build> 
    </profile> 

    <profile> 
     <id>coverage</id> 
     <build> 
     <plugins> 
      <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-plugin</artifactId> 
      <version>2.15</version> 
      </plugin> 
      <plugin> 
      <groupId>org.jacoco</groupId> 
      <artifactId>jacoco-maven-plugin</artifactId> 
      <version>0.6.2.201302030002</version> 
      <executions> 
       <execution> 
       <id>jacoco-initialize</id> 
       <goals> 
        <goal>prepare-agent</goal> 
       </goals> 
       </execution> 
       <execution> 
       <id>jacoco-site</id> 
       <phase>package</phase> 
       <goals> 
        <goal>report</goal> 
       </goals> 
       </execution> 
      </executions> 
      </plugin> 
     </plugins> 
     </build> 
    </profile> 
    </profiles> 
</project> 
相關問題