T_Brown
T_Brown

Reputation: 49

Mavenising an Eclipse Java project without the wizard

This is probably a basic question for you here but here goes:

I'm building a java project using Maven in eclipse at the moment. I have a pom.xml file which is working fine, but I need to be able to organise my source files into 'src/main/java' and resources into 'src/main/resources' etc. Any other maven projects I've looked at are structured like this and the build goes to success without picking up any source files, since it "skips non existent resourceDirectory src/main/resources" and the others.

I currently have a source folder 'src', and eclipse won't let me add more source folders with 'src' in the name.

Any guidance whatsoever would be greatly appreciated.

Upvotes: 1

Views: 593

Answers (3)

davidmontoyago
davidmontoyago

Reputation: 1833

In eclipse right click over the project / Build Path / Configure Build Path / Source (tab)/ Add folder and select the source folder you want. If the folder you need doesn't exist under /src/main create it following the maven conventions.

after that I would recommend:

mvn eclipse:clean eclipse:eclipse

Upvotes: 1

Rob Marrowstone
Rob Marrowstone

Reputation: 1264

Try right-clicking on the project and selecting Maven->Update Project Configuration from the context menu. Then refresh the project. If your pom is close to right, that should represent your project in eclipse the way you want.

Upvotes: 1

Mark Bramnik
Mark Bramnik

Reputation: 42441

Why don't you just open your pom.xml file in eclipse? It can recognize it and will built its project files correspondingly

Upvotes: 1

Related Questions