无法解析scala中的依赖项

egmofgnx  于 2021-07-14  发布在  Java
关注(0)|答案(0)|浏览(228)

我很难解决这个错误。

[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文件的资料,但我不确定这些文件会在哪里。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题