Hello

I want to use solrj in Maven project, but I got errors:

[ERROR] /home/hydra/workspace1/kaks/src/main/java/solr/SolrJExample.java:[9,36] cannot find symbol
[ERROR]   symbol:   class SolrClient
[ERROR]   location: package org.apache.solr.client.solrj
[ERROR] /home/hydra/workspace1/kaks/src/main/java/solr/SolrJExample.java:[14,41] cannot find symbol
[ERROR]   symbol:   class HttpSolrClient
[ERROR]   location: package org.apache.solr.client.solrj.impl
[ERROR] /home/hydra/workspace1/kaks/src/main/java/solr/SolrJExample.java:[32,26] cannot find symbol
[ERROR]   symbol:   class SolrClient
[ERROR]   location: class solr.SolrJExample
[ERROR] /home/hydra/workspace1/kaks/src/main/java/solr/SolrJExample.java:[32,68] package HttpSolrClient does not exist [ERROR] /home/hydra/workspace1/kaks/src/main/java/solr/SolrJExample.java:[133,18] cannot find symbol [ERROR]   symbol:   method setSort(java.lang.String,org.apache.solr.client.solrj.SolrQuery.ORDER) [ERROR]   location: variable solrQuery of type org.apache.solr.client.solrj.SolrQuery [ERROR] /home/hydra/workspace1/kaks/src/main/java/solr/SolrJExample.java:[161,18] cannot find symbol [ERROR]   symbol:   method setSort(java.lang.String,org.apache.solr.client.solrj.SolrQuery.ORDER) [ERROR]   location: variable solrQuery of type org.apache.solr.client.solrj.SolrQuery

My .classpath looks like:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="var" path="TOMCAT_HOME/solr/httpclient5-5.0.3.jar"/>     <classpathentry kind="var" path="TOMCAT_HOME/solr/solr-solrj-8.6.3.jar"/>     <classpathentry kind="var" path="TOMCAT_HOME/solr/commons-codec-1.15.jar"/>     <classpathentry kind="var" path="TOMCAT_HOME/solr/commons-httpclient-3.1.jar"/>
    <classpathentry kind="var" path="TOMCAT_HOME/solr/commons-io-1.4.jar"/>
    <classpathentry kind="var" path="TOMCAT_HOME/solr/jcl-over-slf4j-1.5.5.jar"/>     <classpathentry kind="src" output="target/classes" path="src/main/java">
        <attributes>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="src" output="target/test-classes" path="src/test/java">
        <attributes>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
            <attribute name="test" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
            <attribute name="test" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="output" path="target/classes"/>
</classpath>

Hope that anybody helps me

I Can't udrestand where is mistake ?

Looking forward

Raivo Rebane

I add my pomxml


<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>
 
    <groupId>com.illucit</groupId>
    <artifactId>illucit-solr</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
 
    <properties>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
 
        <!-- Charset -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 
        <!-- Plugin versions -->
        <version.compiler.plugin>3.2</version.compiler.plugin>
        <version.source.plugin>2.4</version.source.plugin>
        <version.javadoc.plugin>2.10.1</version.javadoc.plugin>
 
        <!-- Recent versions of plugins for use in child projects -->
        <version.war.plugin>2.6</version.war.plugin>
 
    </properties>
   <dependencies>
   <dependency>
           <artifactId>solr-solrj</artifactId>
           <groupId>org.apache.solr</groupId>
           <version>1.4.0</version>
           <type>jar</type>
           <scope>compile</scope>
    </dependency>
  </dependencies>
 
    <build>
        <finalName>${project.artifactId}</finalName>
        <sourceDirectory>src</sourceDirectory>
        <testSourceDirectory>test</testSourceDirectory>
        <resources>
            <resource>
                <directory>resources</directory>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>testresources</directory>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <warName>illucit-solr</warName>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${version.compiler.plugin}</version>
                    <configuration>
                        <source>${maven.compiler.source}</source>
                        <target>${maven.compiler.target}</target>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${version.source.plugin}</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${version.javadoc.plugin}</version>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>${version.war.plugin}</version>
                    <configuration>
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                        <attachClasses>true</attachClasses>
                        <warSourceDirectory>WebContent</warSourceDirectory>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
 
</project>

Reply via email to