有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java为什么要删除。导致maven编译错误的目录?

当我在与docker构建项目时遇到困难时,我尝试在没有容器的情况下调试这个问题。我可以通过删除~/.m2目录来复制它。在我运行mvn clean compile之后,插件和依赖项出现在。m2文件夹-包括错误消息中引用的依赖项-但错误仍然存在。一旦我从备份中恢复旧的.m2文件夹,我就能够再次完成编译。由于我在原始的.m2文件夹中有很多依赖项,我很难检查新的.m2文件夹和旧文件夹之间的相关差异。有人知道文件夹的状态会导致问题吗

我还在谷歌上搜索错误本身,但似乎没有任何帮助。当然也感谢这里的每一位帮助

这是我收到的错误消息(docker和“本地”版本的输出相同):

$ mvn clean compile
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------< org.example:jnanomsg_tests >---------------------
[INFO] Building jnanomsg_tests 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ jnanomsg_tests ---
[INFO] Deleting /home/youri/dev/uni/fp/jnanomsg_tests_2/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ jnanomsg_tests ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ jnanomsg_tests ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /home/youri/dev/uni/fp/jnanomsg_tests_2/target/classes
[...]
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.343 s
[INFO] Finished at: 2021-08-09T19:07:30+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project jnanomsg_tests: Compilation failure: Compilation failure: 
[ERROR] /home/youri/dev/uni/fp/jnanomsg_tests_2/src/main/java/Broker.java:[13,45] cannot find symbol
[ERROR]   symbol:   variable Domain
[ERROR]   location: class nanomsg.Nanomsg
[ERROR] /home/youri/dev/uni/fp/jnanomsg_tests_2/src/main/java/Broker.java:[16,45] cannot find symbol
[ERROR]   symbol:   variable Domain
[ERROR]   location: class nanomsg.Nanomsg
[ERROR] /home/youri/dev/uni/fp/jnanomsg_tests_2/src/main/java/Broker.java:[19,56] cannot find symbol
[ERROR]   symbol:   method getFd()
[ERROR]   location: variable s1 of type nanomsg.pubsub.SubSocket
[ERROR] /home/youri/dev/uni/fp/jnanomsg_tests_2/src/main/java/Broker.java:[19,68] cannot find symbol
[ERROR]   symbol:   method getFd()
[ERROR]   location: variable s2 of type nanomsg.pubsub.PubSocket
[ERROR] -> [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/MojoFailureException

这是pom.xml的价值:

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

    <repositories>
        <repository>
            <id>clojars-repo</id>
            <name>Clojars custom repo</name>
            <url>https://clojars.org/repo/</url>
        </repository>
    </repositories>

    <groupId>org.example</groupId>
    <artifactId>jnanomsg_tests</artifactId>
    <version>1.0-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>jnanomsg</groupId>
            <artifactId>jnanomsg</artifactId>
            <version>0.4.3</version>
        </dependency>
    </dependencies>

    <properties>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
</project>

共 (0) 个答案