Ranjan Sarkar
Ranjan Sarkar

Reputation: 61

Create java resources webapp folder structure with maven

I want to create /java, /resources, and /webapp/WEB-INF/web.xml folder structure under src.

I have used the -DarchetypeArtifactId=maven-archetype-webapp but it creates /resources /webapp/WEB-INF/web.xml but doesn't create /java folder.

So in spite of creating the folder /java in eclipse manually is there any other way to create with some -DarchetypeArtifactId= so that it creates the above folder structure.

I'll be thankful if someone can tell me how can I customize and design my folder structure and create it with maven without using existing template.

Upvotes: 4

Views: 15998

Answers (3)

om39a
om39a

Reputation: 1406

When you use -DarchetypeArtifactId=maven-archetype-webapp, java folder wont be created. It needs to be created manually.

It created the following structure

src
└── main
    └── resources
        └── webapp
            └── WEB-INF

Upvotes: 3

TheWhiteRabbit
TheWhiteRabbit

Reputation: 15758

you can create a Maven Webapp using following archetype

-DarchetypeArtifactId=maven-archetype-webapp 

which will automatically creates the desired folder structure

in your case its apart from src\main\java

src\main\resources
src\main\webapp

Upvotes: 0

Andriy Plokhotnyuk
Andriy Plokhotnyuk

Reputation: 7989

Best choice is to follow Maven standard directory layout:

http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html

Archetypes are minimized due different programming languages can be used for web development:

http://cvs.peopleware.be/training/maven/maven2/standardDirLayout.html (link goes to web.archive since the main link is dead)

It will minimize configuration of plugins and also will simplify understanding and maintenance of Maven projects

Upvotes: 2

Related Questions