Maven不想编译源代码

时间:2014-03-11 19:07:34

标签: java eclipse maven

我的专家不想编辑资料来源。它表明他无法找到依赖类。

堆栈追踪:

ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] \MAG\GIT\TechCamp-15\techcamp-15\src\main\java\pl\...\techcamp15\io\CsvWriterTest.java:[3,33] error: package org.fest.assertions does not exist

的pom.xml:

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

<dependencies>
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>16.0.1</version>
    </dependency>

    <dependency>
        <groupId>net.sf.opencsv</groupId>
        <artifactId>opencsv</artifactId>
        <version>2.3</version>
    </dependency>


    <!-- Testing -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.easytesting</groupId>
        <artifactId>fest-assert</artifactId>
        <version>1.4</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>1.9.0</version>
        <scope>test</scope>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>

1 个答案:

答案 0 :(得分:2)

Maven约定指定必须将测试置于src/test/java而不是src/main/java

src/main/java

下的文件无法使用测试范围的依赖项