简体   繁体   中英

maven cannot find symbol

I am running a clean test on my maven project. I am getting the following error:

[ERROR] /Users/afrieden/Projects/CLO-processing/src/main/java/com/aws/mongodb/AWSMongoLoader.java:[51,9] cannot find symbol
[ERROR] symbol:   variable MongoUtility
[ERROR] location: class com.aws.mongodb.AWSMongoLoader

I got this part from running mvn clean test. These two classes are in the same namespace. MongoUtility is a class that just has a bunch of static methods I am using to load data.

Versions of everything:

Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T16:58:10-04:00)
Maven home: /usr/local/Cellar/maven/3.2.3/libexec
Java version: 1.7.0_17, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.9.5", arch: "x86_64", family: "mac"

Associated POM file:

<?xml version="1.0" encoding="UTF-8"?>
  <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>CLO-processing</groupId>
<artifactId>CLO-processing</artifactId>
<version>1.0-SNAPSHOT</version>
<profiles>
    <profile>
        <id>qa</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                    <configuration>
                        <source>1.7</source>
                        <target>1.7</target>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <executions>
                        <execution>
                            <phase>install</phase>
                            <goals>
                                <goal>copy-dependencies</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${project.build.directory}/lib</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <!--<plugin>-->
                    <!--<groupId>org.codehaus.mojo</groupId>-->
                    <!--<artifactId>versions-maven-plugin</artifactId>-->
                    <!--<version>2.1</version>-->
                <!--</plugin>-->
                <!--<plugin>-->
                    <!--<artifactId>maven-scm-plugin</artifactId>-->
                    <!--<version>1.8.1</version>-->
                    <!--<configuration>-->
                        <!--<tag>${project.artifactId}-${project.version}</tag>-->
                    <!--</configuration>-->
                <!--</plugin>-->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.9</version>
                    <configuration>
                        <useFile>false</useFile>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>
<repositories>
    <repository>
        <id>in-project</id>
        <name>In Project Repo</name>
        <url>file://${project.basedir}/libs</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>mygroupid</groupId>
        <artifactId>mycustomartifact</artifactId>
        <version>2.0</version>
    </dependency>
    <dependency>
        <groupId>org.codehaus.groovy.modules.http-builder</groupId>
        <artifactId>http-builder</artifactId>
        <version>0.7</version>
    </dependency>
    <dependency>
        <groupId>org.utgenome.thirdparty</groupId>
        <artifactId>picard</artifactId>
        <version>1.86.0</version>
    </dependency>
    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongo-java-driver</artifactId>
        <version>2.12.2</version>
    </dependency>
    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk</artifactId>
        <version>1.8.5</version>
    </dependency>
    <dependency>
        <groupId>com.github.fakemongo</groupId>
        <artifactId>fongo</artifactId>
        <version>1.5.7</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.7</version>
    </dependency>
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>2.1.1</version>
    </dependency>
</dependencies>

</project>

What is going wrong here? I am able to do mvn test fine with the intellij compiled class files. Any help is appreciated!

something is wrong with your java file. the path is: com/aws/mongodb/AWSMongoLoader but the error talks about location: class com.gsg.aws.mongodb.AWSMongoLoader which means the package declaration got gsg there, but its not the right path in the file system.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM