maven找不到符号

时间:2014-11-18 17:54:59

标签: java maven groovy

我正在对我的maven项目进行一次干净的测试。我收到以下错误:

[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

我从运行mvn clean test得到了这个部分。这两个类位于同一名称空间中。 MongoUtility是一个只有一堆静态方法的类,我用它来加载数据。

所有内容的版本:

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"

关联的POM文件:

<?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>

这里出了什么问题?我可以使用intellij编译的类文件mvn test。任何帮助表示赞赏!

1 个答案:

答案 0 :(得分:0)

你的java文件有问题。 路径是:com / aws / mongodb / AWSMongoLoader 但错误谈到位置:class com.gsg.aws.mongodb.AWSMongoLoader 这意味着包声明在那里得到了gsg,但它不是文件系统中的正确路径。