使用maven-plugin的Scala无法找到依赖项

Vin*_*lho 1 spring scala maven

我有一个使用maven的scala项目.当我只使用scala类时,maven插件没有问题.但是现在,我在尝试编译时遇到错误:

[警告] C:\ java的\工作空间\ mcare\SRC \主\阶\ COM\FB\mcare \配置\ AppConfig.scala:2:错误:对象springframework的是不包组织的成员[警告]进口org.springframework .context.annotation.Configuration

package com.fb.mcare.config
import org.springframework.context.annotation.Configuration

@Configuration
class AppConfig {

}
Run Code Online (Sandbox Code Playgroud)

我的pom:

http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.fb mcare 0.0.1-SNAPSHOT 2008 2.9.1-1 3.1.0.RELEASE war scala-tools.org Scala-Tools Maven2存储库http://scala-tools.org/repo-releases com.springsource.repository.maven.release http://maven.springframework.org/release/ false

<pluginRepositories>
    <pluginRepository>
        <id>scala-tools.org</id>
        <name>Scala-Tools Maven2 Repository</name>
        <url>http://scala-tools.org/repo-releases</url>
    </pluginRepository>
</pluginRepositories>

<dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${spring.version}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring.version}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.scala-lang</groupId>
        <artifactId>scala-library</artifactId>
        <version>${scala.version}</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.4</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.specs</groupId>
        <artifactId>specs</artifactId>
        <version>1.2.5</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-servlet_3.0_spec</artifactId>
        <version>1.0</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.scala-tools</groupId>
                <artifactId>maven-scala-plugin</artifactId>
                <version>2.9.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
            </plugin>
        </plugins>
    </pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.scala-tools</groupId>
            <artifactId>maven-scala-plugin</artifactId>
            <executions>
                <execution>
                    <id>scala-compile-first</id>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>add-source</goal>
                        <goal>compile</goal>
                    </goals>
                </execution>
                <execution>
                    <id>scala-test-compile</id>
                    <phase>process-test-resources</phase>
                    <goals>
                        <goal>testCompile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)

几乎尝试了一切,我在这里想念的是什么?

问候

mpi*_*ist 5

尝试<scope>runtime</scope>从pom.xml中的spring-context依赖项中删除.运行时范围依赖项不包含在编译时类路径中.有关各种范围的更多信息,请参见http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html.