从控制台运行的MVN不起作用,从Eclipse工作

时间:2016-02-15 10:27:56

标签: java eclipse maven solr

我找不到答案,这就是我要问的原因。

我有maven项目:Spring + hibernate和版本3.6.1中的 Solr。

当我从Eclipse Luna构建它时,Project正在按预期工作(使用Eclipse Luna,Java 8的maven M2插件)。 但是,当我从系统控制台运行它时(在Ubuntu 14.04,maven ver.3,Java 8上)构建失败是因为:

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/dstachyra/git/bip/bip-persist/src/main/java/eu/arrow/bip/persist/indexing/SolrServerFactory.java:[244,90] error: cannot access ResourceLoader
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.049 s
[INFO] Finished at: 2016-02-15T11:20:59+01:00
[INFO] Final Memory: 24M/361M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project bip-persist: Compilation failure
[ERROR] /home/dstachyra/git/bip/bip-persist/src/main/java/eu/arrow/bip/persist/indexing/SolrServerFactory.java:[244,90] error: cannot access ResourceLoader

我在这里找到了原因:I'm trying to index files in a document through SOLR and lucene..

导致错误的类的一部分如下:

CoreContainer container = new CoreContainer( new SolrResourceLoader(SolrResourceLoader.locateInstanceDir()));

我的pom.xml(来自eclipse的工作,不是来自系统控制台):

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>eu.arrow</groupId>
        <artifactId>bip-modular-registry</artifactId>
        <version>1.0.0-FINAL</version>
    </parent>
    <artifactId>blue-persist</artifactId>
    <packaging>jar</packaging>

    <name>Persistence API</name>

    <description>This module contains some Data Access Objects (DAO) which are configured
to store business objects in an relational database</description>

    <properties>
        <version.springdatajpa>1.3.4.RELEASE</version.springdatajpa>
        <version.solr>3.6.1</version.solr> 
    </properties>

    <dependencies>
        <dependency>
            <groupId>eu.arrow</groupId>
            <artifactId>bip-model</artifactId>
            <version>1.0.0-FINAL</version>
        </dependency>

        <!-- Import the JPA API using the provided scope It is included in JBoss AS 7 / EAP 6 -->
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.0-api</artifactId>
            <version>1.0.0.Final</version>
            <!-- <scope>provided</scope> -->
        </dependency>

        <!-- Annotation processor that raising compilation errors whenever constraint annotations are incorrectly used. -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator-annotation-processor</artifactId>
            <version>4.1.0.Final</version>
            <!-- <scope>provided</scope> -->
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${version.hibernate}</version>
            <!-- <scope>provided</scope> -->
        </dependency>

        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <version>2.2</version>
        </dependency>

        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <version>2.2.8</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.21</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>c3p0</groupId>
            <artifactId>c3p0</artifactId>
            <version>0.9.1.2</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${org.slf4j-version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>javax.mail</groupId>
                    <artifactId>mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.jms</groupId>
                    <artifactId>jms</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jdmk</groupId>
                    <artifactId>jmxtools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jmx</groupId>
                    <artifactId>jmxri</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Spring Data JPA -->
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>${version.springdatajpa}</version>
        </dependency>

        <!-- Spring Data Solr -->
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-solr</artifactId>
            <version>1.0.0.RC1</version>
        </dependency>

        <!-- Required by embedded solr server -->
        <dependency>
            <groupId>org.apache.solr</groupId>
            <artifactId>solr-core</artifactId>
            <version>${version.solr}</version>
            <exclusions>
                <exclusion>
                    <artifactId>slf4j-jdk14</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.1.3</version>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
            <version>4.1.3</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>3.1</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <repositories>
        <repository>
            <id>spring-milestone</id>
            <name>Spring Milestone Maven Repository</name>
            <url>http://repo.springsource.org/libs-milestone</url>
        </repository>
    </repositories>
</project>

我知道它可能因solr版本而失败,但是它在Eclipse中工作。问题是为什么?

---编辑--- 我在Eclipse中查看了Maven Dependencies,我看到了:

  • solr-solrj-4.1.0.jar
  • solr的核 - 3.6.1.jar
  • 很多lucene jars in ver。 3.6.1

我试图在Eclipse中搜索ResourceLoader类(CTRL + T)并且它确实存在。还有其他类:来自solr-core.3.6.1库的org.apache.solr.util.plugin.ResourceLoaderAware。

0 个答案:

没有答案