复制依赖项后在jar根文件夹中移动文件

时间:2019-02-19 22:34:33

标签: java maven minecraft

我具有所有依赖项和Maven阴影插件的附件pom.xml。这是Minecraft插件,这意味着应该有一个plugin.yml文件,以使服务器知道它是插件。

一旦maven构建了我的jar,它就不再位于jar的根目录中。我如何告诉Maven捆绑所有依赖项来构建此jar,然后将plugin.yml/src移至档案的根目录?

这是jar的根目录。如您所见,它缺少plugin.yml文件。

Screenshot

这是我的pom.xml

<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>HyperiumSystem</groupId>
  <artifactId>HyperiumSystem</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.2.1</version>
        <executions>
          <execution>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <manifestEntries>
                    <Main-Class>${app.main.class}</Main-Class>
                    <X-Compile-Source-JDK>${maven.compile.source}</X-Compile-Source-JDK>
                    <X-Compile-Target-JDK>${maven.compile.target}</X-Compile-Target-JDK>
                  </manifestEntries>
                </transformer>
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <repositories>
    <!-- Spigot repo -->
    <repository>
        <id>spigot-repo</id>
        <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
    </repository>
    <!-- JDA repo -->
    <repository>
    <snapshots>
      <enabled>false</enabled>
    </snapshots>
      <id>jcenter</id>
      <name>jcenter-bintray</name>
      <url>http://jcenter.bintray.com</url>
    </repository>
  </repositories>
  <dependencies>
    <!-- Spigot -->
    <dependency>
      <groupId>org.spigotmc</groupId>
      <artifactId>spigot-api</artifactId>
      <version>1.13.2-R0.1-SNAPSHOT</version>
      <scope>provided</scope>
    </dependency>
    <!-- JDA -->
    <dependency>
      <groupId>net.dv8tion</groupId>
      <artifactId>JDA</artifactId>
      <version>4.ALPHA.0_47</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <!-- org.json -->
    <dependency>
      <groupId>org.json</groupId>
      <artifactId>json</artifactId>
      <version>20180813</version>
    </dependency>
  </dependencies>
</project>

0 个答案:

没有答案