Java“找不到符号”错误

时间:2018-06-24 00:43:11

标签: java maven intellij-idea

我正在尝试在Intellij中制作一个Uber jar,并用maven shade遇到了这个问题。我看过其他解决方案,但似乎没有任何效果。我的项目是为Minecraft制作一个插件,如果有帮助的话。我运行“ mvn软件包”或“ mvn编译”,它会在下面产生错误。

错误:

C:\Users\luckycosmos\IdeaProjects\discordMC>mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< me.cosmicluck:discordMC >-----------------------
[INFO] Building discordMC 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ discordMC ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ discordMC ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 6 source files to C:\Users\luckycosmos\IdeaProjects\discordMC\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/DiscordHandler.java:[1,39] package com.onarandombox.MultiverseCore does not exist
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/Main.java:[1,39] package com.onarandombox.MultiverseCore does not exist
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/DiscordHandler.java:[19,13] cannot find symbol
  symbol:   class MultiverseCore
  location: class DiscordHandler
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/DiscordHandler.java:[21,43] cannot find symbol
  symbol:   class MultiverseCore
  location: class DiscordHandler
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/Main.java:[12,13] cannot find symbol
  symbol:   class MultiverseCore
  location: class Main
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/Main.java:[30,12] cannot find symbol
  symbol:   class MultiverseCore
  location: class Main
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/Main.java:[52,12] cannot find symbol
  symbol:   class MultiverseCore
  location: class Main
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[1,39] package com.onarandombox.MultiverseCore does not exist
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[2,43] package com.onarandombox.MultiverseCore.api does not exist
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[3,43] package com.onarandombox.MultiverseCore.api does not exist
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[13,13] cannot find symbol
  symbol:   class MultiverseCore
  location: class MVManager
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[16,15] cannot find symbol
  symbol:   class MultiverseCore
  location: class MVManager
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[21,12] cannot find symbol
  symbol:   class MVWorldManager
  location: class MVManager
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[25,50] cannot find symbol
  symbol:   class MVWorldManager
  location: class MVManager
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[25,23] cannot find symbol
  symbol:   class MultiverseWorld
  location: class MVManager
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[29,49] cannot find symbol
  symbol:   class MultiverseWorld
  location: class MVManager
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/Main.java:[33,31] cannot find symbol
  symbol:   class MultiverseCore
  location: class Main
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/Main.java:[34,21] cannot find symbol
  symbol:   class MultiverseCore
  location: class Main
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[31,13] cannot find symbol
  symbol:   class MultiverseWorld
  location: class MVManager
[INFO] 19 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.685 s
[INFO] Finished at: 2018-06-23T20:28:39-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project discordMC: Compilation failure: Compilation failure:
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/DiscordHandler.java:[1,39] package com.onarandombox.MultiverseCore does not exist
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/Main.java:[1,39] package com.onarandombox.MultiverseCore does not exist
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/DiscordHandler.java:[19,13] cannot find symbol
[ERROR]   symbol:   class MultiverseCore
[ERROR]   location: class DiscordHandler
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/DiscordHandler.java:[21,43] cannot find symbol
[ERROR]   symbol:   class MultiverseCore
[ERROR]   location: class DiscordHandler
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/Main.java:[12,13] cannot find symbol
[ERROR]   symbol:   class MultiverseCore
[ERROR]   location: class Main
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/Main.java:[30,12] cannot find symbol
[ERROR]   symbol:   class MultiverseCore
[ERROR]   location: class Main
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/Main.java:[52,12] cannot find symbol
[ERROR]   symbol:   class MultiverseCore
[ERROR]   location: class Main
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[1,39] package com.onarandombox.MultiverseCore does not exist
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[2,43] package com.onarandombox.MultiverseCore.api does not exist
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[3,43] package com.onarandombox.MultiverseCore.api does not exist
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[13,13] cannot find symbol
[ERROR]   symbol:   class MultiverseCore
[ERROR]   location: class MVManager
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[16,15] cannot find symbol
[ERROR]   symbol:   class MultiverseCore
[ERROR]   location: class MVManager
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[21,12] cannot find symbol
[ERROR]   symbol:   class MVWorldManager
[ERROR]   location: class MVManager
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[25,50] cannot find symbol
[ERROR]   symbol:   class MVWorldManager
[ERROR]   location: class MVManager
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[25,23] cannot find symbol
[ERROR]   symbol:   class MultiverseWorld
[ERROR]   location: class MVManager
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[29,49] cannot find symbol
[ERROR]   symbol:   class MultiverseWorld
[ERROR]   location: class MVManager
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/Main.java:[33,31] cannot find symbol
[ERROR]   symbol:   class MultiverseCore
[ERROR]   location: class Main
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/Main.java:[34,21] cannot find symbol
[ERROR]   symbol:   class MultiverseCore
[ERROR]   location: class Main
[ERROR] /C:/Users/luckycosmos/IdeaProjects/discordMC/src/main/java/MVManager.java:[31,13] cannot find symbol
[ERROR]   symbol:   class MultiverseWorld
[ERROR]   location: class MVManager
[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>

    <groupId>me.cosmicluck</groupId>
    <artifactId>discordMC</artifactId>
    <version>1.0-SNAPSHOT</version>

    <repositories>
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>jcenter</id>
            <name>jcenter-bintray</name>
            <url>http://jcenter.bintray.com</url>
        </repository>
    </repositories>
    <dependencies>
        <!--Spigot API-->
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.12.2-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <!--Bukkit API-->
        <dependency>
            <groupId>org.bukkit</groupId>
            <artifactId>bukkit</artifactId>
            <version>1.12.2-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>net.dv8tion</groupId>
            <artifactId>JDA</artifactId>
            <version>3.6.0_365</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <!-- Maven Shade Plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <!-- Run shade goal on package phase -->
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

我检查了我的JDK主页,一切都正确。我对为什么发生这种情况感到困惑,我从未见过这种情况发生。希望我能对此有所启发。

0 个答案:

没有答案