To better understand the Builder design pattern, I have downloaded a code demonstration which I am now trying to compile using maven. The demonstration code is made available in a single directory but the various java
files have import statements reading
import aaa.bbb.ccc.ddd.A;
import aaa.bbb.ccc.ddd.B;
import aaa.bbb.ccc.ddd.C;
import aaa.bbb.ccc.eee.D;
import aaa.bbb.ccc.eee.E;
import aaa.bbb.ccc.eee.F;
import aaa.bbb.ccc.fff.G;
import aaa.bbb.ccc.fff.H;
import aaa.bbb.ccc.fff.I;
import aaa.bbb.ccc.fff.J;
import aaa.bbb.ccc.ggg.K;
with Main.java expected to be in directory ccc
.
I'm relatively new to maven
having generally built packages directly in eclipse
so I've got a couple of questions relating to maven
which, whilst relevant to this particular demonstration, are also relevant to some other projects I have:
maven
to use the import
statements in the various java
files to infer and build an appropriate directory structure, including the target structure? maven
to move the files, currently in a single directory, into their appropriate directories? maven
build the appropriate pom.xml file?I think you have a wrong comprehension about maven. Maven will not organize your Java code for you.
Maven helps you to compile and test your Java code and create a jar File containing your Java code.
Therefore you have to create a pom.xml for your Eclipse Project with your configuration. Which could be supported by maven as described at https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html or Eclipse creating new Maven Project. Maven is assuming some default configuration like sourceDirectory in Eclipse Project is src/main/java
and more.
And the answers are: No. No. No.
You could create maven plugins which are doing your desired Things but maven itself will not do those things.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.