微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法解析 Scala 中的依赖项

如何解决无法解析 Scala 中的依赖项

我真的很难解决这个错误

[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------< com.bosch.us.dm.test:isbn-encoder >------------------
[INFO] Building isbn-encoder 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/spark/spark-core_2.1/2.1.1/spark-core_2.1-2.1.1.pom
[WARNING] The POM for org.apache.spark:spark-core_2.1:jar:2.1.1 is missing,no dependency information available
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/spark/spark-sql_2.1/2.1.1/spark-sql_2.1-2.1.1.pom
[WARNING] The POM for org.apache.spark:spark-sql_2.1:jar:2.1.1 is missing,no dependency information available
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/spark/spark-core_2.1/2.1.1/spark-core_2.1-2.1.1.jar
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/spark/spark-sql_2.1/2.1.1/spark-sql_2.1-2.1.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.081 s
[INFO] Finished at: 2021-04-17T20:22:31-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project isbn-encoder: Could not resolve dependencies for project com.bosch.us.dm.test:isbn-encoder:jar:0.0.1-SNAPSHOT: The following artifacts Could not be resolved: org.apache.spark:spark-core_2.1:jar:2.1.1,org.apache.spark:spark-sql_2.1:jar:2.1.1: Could not find artifact org.apache.spark:spark-core_2.1:jar:2.1.1 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors,re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions,please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

我正在使用 maven 进行编译。我试过更改 scala maven 插件版本,但这似乎没有帮助。我不太了解 pom.xml 文件,所以它很可能是我问题的根源。 pom.xml 看起来像这样

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         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.bosch.us.dm.test</groupId>
    <artifactId>isbn-encoder</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <properties>
        <spark.version>2.1.1</spark.version>
        <scala.dep.version>2.1</scala.dep.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-core_${scala.dep.version}</artifactId>
            <version>${spark.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-sql_${scala.dep.version}</artifactId>
            <version>${spark.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- mixed scala/java compile -->
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>3.3.3</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <phase>compile</phase>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <phase>test-compile</phase>
                    </execution>
                    <execution>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

我读过一些建议删除 jar 文件的消息来源,但我不确定这些文件的位置。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。