Eclipse -> Maven -> Update Project Configuration and Maven Standard Directory Layout - eclipse

I am utilizing the standard maven directory layout in my eclipse maven project:
src/main/java
src/main/assembly
src/main/config
src/main/scripts
src/main/resources
src/test/java
src/test/resources
as per the: http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
Whenever I then use 'Maven -> Update Project Configuration' in the m2e plugin the 'assembly', 'config' and 'scripts' directories are being removed by m2e from source folders. I would appreciate if anyone could suggest how to configure m2e to respect the standard maven layout. I used the basic java archetype offered by m2e to create the project.

With the maven-build-helper plugin you can add additional source folders to your build. To make eclipse extract that information from the plugin you need the m2e connectors buildhelper and m2e-apt. They can be found on the marketplace.

Related

How to add Maven dependencies in Eclipse libaries

Can any one explain how to add Maven dependency JAR i.e. build path libraries? To be very specific how to include JAR file mentioned in pom.xml to Java build path? Maven dependencies - unable to see jars over here.
Don't have a option to update Maven dependencies. Also executed the script mvn eclipse:eclipse, seen on StackOverflow.
Generally, you should not have any need to deal with such a task manually. Here is the correct procedure for importing of maven project to your Eclipse IDE:
Make sure you have m2eclipse plugin installed (Maven support for Eclipse). As far I remember it is included to Eclipse IDE for JEE developers by default.
Checkout your maven project to any directory
From this directory (root pom.xml is located in), run: mvn eclipse:eclipse
Go to Eclipse, File -> Import, select "Existing maven project"
Select directory where your root pom.xml is located, Eclipse should find all maven modules.
Optional: if eclipse will tell you that it can't recognize some maven plugins - ignore this, just continue.
If you follow this instruction, IDE will create all maven modules as eclipse projects and you will have an option to update maven dependencies and also willsee all of them rigth in IDE.

maven plugin in eclipse

Will all the jars used by the project added automatically to build path of project in eclipse by adding the maven plugin to eclipse(m2eclipse)? If not added automatically what should be done to get the jars into build path?
Will all the jars used by the project added automatically to build
path of project in eclipse by adding the maven plugin to
eclipse(m2eclipse)?
All the JARs that you define as dependencies in pom.xml will be added automatically to the Eclipse build path.
If your project is set up as a Maven project in Eclipse, then yes. Also this assumes that your settings.xml file and pom.xml are correct.
If it is an exsisting non-maven project, you will need to use the context menus to convert it into a maven project before the dependencies are added.

How do I have Maven install and/or configure eclipse plugins automatically

I am new to eclipse and the interaction between eclipse and maven.
Is it possible to have Maven automatically install Eclipse plugins if the eclipse path is known?
Is it possible to configure specific project settings for each installed plugin when the eclipse project is created? Is it easy to update these configuration settings once the eclipse project is created?
How may I go about this using Maven? Or is it not possible/ideal?
To install a plugin, you would have to copy the plugin files to the eclipse/plugins folder as described in the Eclipse wiki
You can use maven to copy the plugin files/folders to the eclipse plugins directory. This question will show how: Best practices for copying files with Maven
However, I would not advise to use maven to configure the IDE and its plugins, you should manage your projects and not your IDEs with maven.

Maven add source directory in Eclipse

I get my code generated from the maven-jaxb2-plugin maven plugin. It puts the code into target/generated-sources. Now I have to manually left click onto the project -> properties-> Java Build Path-> Add Folder.... That's kind of annoying for someone downloading it from SVN.
Is there some way to get that dome automatically through my pom?
This kind of stuff is the responsibility of IDE's Maven plugin and fortunately M2E supports it since recently (finally!) through the concept of M2E connectors, that is M2E extensions that understand a nature and lifecycle binding of certain plugins. And because it's since recently, not much Maven plugins have their connectors for M2E.
However, you're lucky, because Jaxb2 plugins are actually already supported. I assume you're already using M2E. Then go to Preferences -> Maven -> Discovery, then Open Catalog, then find Jaxb2 connector.
maven add-sources should do the trick for netbeans or eclipse
M2E and having maven generated source folders as eclipse source folders

What eclipse plugin the project is required?

I have found this project sample. It says it is an eclipse project type but I am wondering what eclipse plugin does it require to be compiled successfully? I'd like to build the sample with my eclipse but I am not sure how should I prepare my eclipse to compile such kind of project? What additional libs etc... So I need your advice
Here is its structure screen shot
project source...
Any useful comment is appreciated
That looks more like a maven project structure - check if it has a pom.xml.
In the root directory of the project , I found it has a pom.xml , so it is a Maven based project.
Looking into .project file (an eclipse project-specific file) , it has the following :
<nature>org.maven.ide.eclipse.maven2Nature</nature>
org.maven.ide.eclipse.maven2Nature means that the project has the m2eclipse (a maven pluign for eclipse) nature .Note that after the version 0.12.1 , m2eclipse project is moved to Eclipse Foundation and become the part of Eclipse 3.7 (Indigo) release . The name of this nature becomes org.eclipse.m2e.core.maven2Nature
Besides ,I also found that there are some WTP-specified setting files (eg org.eclipse.wst.common.project.facet.core.xml) in the .setting folder . WTP is included inside the 'Java EE Developers version' of eclipse by default.
So , this project is created by eclipse installed with the WTP and the m2eclipse with the version at or before 0.12.1.
how should I prepare my eclipse to compile such kind of project? What
additional libs etc.
As it is a maven project , you don't have to include the additional libs explicitly . All the libs required are configured inside the pom.xml and maven will download these libs for you.
For me , I would use an eclipse installed with WTP , m2eclipse ,m2eclipse-wtp and GWT eclipse plugin . Then create a new maven war application , and only copy the pom.xml and the src folder to the project .After that use the m2eclipse function to update the download libs and those project-specified setting files.