2017-02-04 44 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> 
相关问题