Solved Maven issues

Discussion in 'Spigot Plugin Development' started by ramidzk, Jun 12, 2017.

  1. I'm using maven and I'm using a custom parent project. It builds fine but there are two problems:
    1. Files in src/main/resources (like plugin.yml) is getting saved in a folder called 'resources' in the JAR. Don't want that
    2. Source code is getting saved ALSO in the JAR in a folder called java
    How would I stop this from happening?
    Code (Text):
    <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.ramidzkh.spigot</groupId>
      <artifactId>tag</artifactId>
      <version>0.0.1-SNAPSHOT</version>
     
      <parent>
        <groupId>me.ramidzkh</groupId>
        <artifactId>spigot-core</artifactId>
        <version>1.0.0</version>
      </parent>
     
    </project>

    Code (Text):
    <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>
     
      <packaging>pom</packaging>
     
      <groupId>me.ramidzkh</groupId>
      <artifactId>spigot-core</artifactId>
      <version>1.0.0</version>
     
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
       
        <spigot.version>1.12-R0.1-SNAPSHOT</spigot.version>
      </properties>
     
      <build>
        <finalName>${project.artifactId}-${project.version}</finalName>
        <defaultGoal>package</defaultGoal>
       
        <resources>
          <resource>
            <directory>src/main</directory>
            <filtering>true</filtering>
          </resource>
        </resources>
       
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.6.1</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.0.0</version>
            <configuration>
              <dependencyReducedPomLocation>${project.build.directory}\dependency-reduced-pom.xml</dependencyReducedPomLocation>
            </configuration>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>shade</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
     
      <repositories>
        <repository>
          <id>spigot-api</id>
          <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
      </repositories>
     
      <dependencies>
        <dependency>
          <groupId>org.spigotmc</groupId>
          <artifactId>spigot-api</artifactId>
          <version>${spigot.version}</version>
          <scope>provided</scope>
        </dependency>
      </dependencies>
     
    </project>

    And yes, spigot-core in on my local repo
     
  2. Figured it out already :confused:
    I can't just filter src/main but src/main/java and src/main/resources individually
     
  3. Something called JavaDocs that I will use later