在jar中编译了相关性,但给出了NoSuchMethod错误

时间:2019-03-08 20:32:14

标签: java maven

前一段时间,我决定在我的项目中为需要从其他不同模块访问的内容创建一个通用模块。我只是将依赖项添加到其他模块中,直到现在为止还可以正常工作。我添加了一些新方法和一些静态字符串,并且在重建模块之后,现在在所有新方法上都向我显示NoSuchMethod错误。

这是我的pom文件:

<?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>com.fadelands.Core</groupId>
    <artifactId>Core</artifactId>
    <version>1.0-SNAPSHOT</version>

    <packaging>jar</packaging>

    <name>Core</name>

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

    <build>
        <defaultGoal>clean install</defaultGoal>
        <finalName>${project.name}-${project.version}</finalName>
        <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
        <resources>
            <resource>
                <targetPath>.</targetPath>
                <filtering>true</filtering>
                <directory>${basedir}/src/main/resources</directory>
                <includes>
                    <include>*.yml</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <!-- Maven Shade -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.1.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            <artifactSet>
                                <excludes>
                                    <exclude>org.bukkit:*</exclude>
                                </excludes>
                            </artifactSet>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies> 

        <dependency>
            <groupId>org.bukkit</groupId>
            <artifactId>bukkit</artifactId>
            <version>LATEST</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/../spigot-1.8.8.jar</systemPath>
        </dependency>

        <dependency>
            <groupId>com.fadelands.Common</groupId>
            <artifactId>Common</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>

    </dependencies>
</project>

正如在pastebin中看到的那样,我正在编译Common依赖项,并且从现在开始一直运行良好。如果有人可以告诉我我做错了什么,那真是太棒了。预先感谢。

0 个答案:

没有答案