Solved No target created in parent module when building multi-module Maven project

Discussion in 'Spigot Plugin Development' started by eirikh1996, Sep 12, 2019 at 1:35 AM.

Thread Status:
Not open for further replies.
  1. Hello. I am trying to build a multi-module project. However, I have run into an issue that is nonexistent in other multi-module projects I work on: target directory (where thee built jar appears) are not created in the parent module

    Parent POM:

    HTML:
    <?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>io.github.eirikh1996</groupId>
        <artifactId>Movecraft-Factions-Parent</artifactId>
        <packaging>pom</packaging>
        <version>parent</version>
        <name>Movecraft-Factions Parent Pom</name>
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        </properties>
        <modules>
            <module>F3</module>
            <module>Movecraft-Factions</module>

        </modules>
        <repositories>
            <repository>
                <id>spigot-repo</id>
                <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
            </repository>
        </repositories>
        <dependencies>
            <dependency>
                <groupId>org.bukkit</groupId>
                <artifactId>bukkit</artifactId>
                <version>1.12.2-R0.1-SNAPSHOT</version>
            </dependency>

        </dependencies>
        <build>

            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
            </plugins>
        </build>

    </project>
    Dependency module POM:
    HTML:
    <?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">
        <parent>
            <artifactId>Movecraft-Factions-Parent</artifactId>
            <groupId>io.github.eirikh1996</groupId>
            <version>parent</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>

        <artifactId>Movecraft-Factions-F3</artifactId>
        <packaging>jar</packaging>
        <name>Movecraft-Factions-F3</name>
        <version>F3</version>
        <dependencies>
            <dependency>
                <groupId>com.massivecraft</groupId>
                <artifactId>MassiveCore</artifactId>
                <version>3.2.3</version>
                <scope>system</scope>
                <systemPath>${project.basedir}/../libs/f3/MassiveCore.jar</systemPath>
            </dependency>
            <dependency>
                <groupId>com.massivecraft</groupId>
                <artifactId>Factions</artifactId>
                <version>3.2.3</version>
                <scope>system</scope>
                <systemPath>${project.basedir}/../libs/f3/Factions.jar</systemPath>
            </dependency>
        </dependencies>
        <build>
            <sourceDirectory>src/main/java</sourceDirectory>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.7.0</version>
                    <configuration>
                        <includes>
                            <include>io/github/eirikh1996/movecraftfactions/f3/**</include>
                        </includes>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>2.4</version>
                    <configuration>
                        <includes>
                            <include>io/github/eirikh1996/movecraftfactions/f3/**</include>
                        </includes>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </project>
    Plugin module
    HTML:
    <?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">
        <parent>
            <artifactId>Movecraft-Factions-Parent</artifactId>
            <groupId>io.github.eirikh1996</groupId>
            <version>parent</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>

        <artifactId>Movecraft-Factions</artifactId>
        <packaging>jar</packaging>
        <name>Movecraft-Factions</name>
        <version>1.0</version>

        <dependencies>
            <dependency>
                <groupId>com.massivecraft</groupId>
                <artifactId>MassiveCore</artifactId>
                <version>2.14.1</version>
                <scope>system</scope>
                <systemPath>${project.basedir}/../libs/MassiveCore.jar</systemPath>
            </dependency>
            <dependency>
                <groupId>com.massivecraft</groupId>
                <artifactId>Factions</artifactId>
                <version>3.2.3</version>
                <scope>system</scope>
                <systemPath>${project.basedir}/../libs/Factions.jar</systemPath>
            </dependency>
            <dependency>
                <groupId>net.countercraft</groupId>
                <artifactId>Movecraft</artifactId>
                <version>7.0.0</version>
                <scope>system</scope>
                <systemPath>${project.basedir}/../libs/Movecraft.jar</systemPath>
            </dependency>
            <dependency>
                <groupId>io.github.eirikh1996</groupId>
                <artifactId>Movecraft-Factions-F3</artifactId>
                <version>F3</version>
                <type>jar</type>
            </dependency>
        </dependencies>
        <build>
            <finalName>Movecraft-Factions</finalName>
            <directory>/../target</directory>

            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>2.4</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.7.0</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>2.8.1</version>
                    <configuration>
                        <excludePackageNames>*.metrics</excludePackageNames>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>1.4</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>shade</goal>
                            </goals>
                            <configuration>
                                <artifactSet>
                                    <includes>
                                        <include>io.github.eirikh1996.movecraftfactions:Movecraft-Factions*</include>
                                    </includes>
                                </artifactSet>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>


    </project>
    This is supposed to create a target directory in the parent module, but it doesn't, even when running mvn clean install. Is the POM wrongly configured?
     
Thread Status:
Not open for further replies.