A
A
AwvuweWd2019-05-28 23:00:45
Java
AwvuweWd, 2019-05-28 23:00:45

How to make a modular java maven project?

the structure is
jdcs{ Libs_...{1,2,3
1(Network)
2(Gui)
3(Handler)
compile into jar (executable)
1,2,3 sorts (libraries, access to them is needed in jdcs (import . ...))
New to maven ((

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TheRonCronix, 2019-05-29
@TheRonCronix

Each submodule has its own pom.xml They can be combined into one parent pom.xml.
parent pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project ...>
    <artifactId>jdcs</artifactId>
    ...
    <modules>
       <module>net</module>
        <module>gui</module>
        <module>handler</module>
    </modules>
    ...

In submodules, you can refer to parent and specify dependencies on other submodules:
<project ...>
    <artifactId>gui</artifactId>
    ...
    <parent>
        <groupId>com.jdcs</groupId>
        <artifactId>jdcs</artifactId>
        <version>0.0.1</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>com.jdcs.net</groupId>
            <artifactId>net</artifactId>
            <version>${project.version}</version>
        </dependency>
        ....
    </dependencies>

    ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question