What is the best practice for importing an existing Maven project (of type war) into MyEclipse 8.5 with goals of developing with Wicket, auto building and hot deploying with debugging enabled?
Currently I do:
1) File, Import, Maven4MyEclipse, Existing Maven Projects, choose pom.xml directory, finish.
- I get an error message: An internal error occurred during: "Importing Maven projects".
Invalid thread access, although I just hit OK and continue.
2) I right click on the project, select Run As, Maven package (this creates the necessary target/myapp/ directory in the next step
3) I right click on the maven war project and select MyEclipse, Add Web Project Capabilities...
- select /target/myapp for the web root dir, adjust my web context root, uncheck create web.xml, check j2ee 5.0 and uncheck add j2ee lib to buildpath (its in the maven dependencies)
- click finish and say Yes to reset output folders
4) right click on the project, select properties, MyEclipse, Web and see that my changes I just made for web root and web context did NOT take effect, this is a bug. I reset my web root and web context as in step 3 and hit OK.
5) right click on my project, select properties, Java Build Path, Source tab, click on the entry for src/main/resources and remove the entry for "excluded: **". Click Add Folder and add src/main/webapp. Click on Allow output folders for source folders. Click on Output folder for src/main/webapp and change it to target/myapp. Click OK but an error message says "Cannot nest 'myapp-web/target/myapp/WEB-INF/lib/some.random.jar' inside of output folder... to get rid of this message I click on the project properties, Maven4MyEclipse, select Update Project Configuration. Go back and do the above steps. So now I have 3 folders, src/main/java, src/main/resources and src/main/webapp in the Source tab, with no includes or excludes set, with the check box set for allow output folders for source folders, with java and resources dir set for the output dir of myapp-web/target/myapp/WEB-INF/classes, the webapp dir output folder set to myapp-web/target/myapp and the default output dir set to myapp-web/target/myapp/WEB-INF/classes just to be sure.
6) Add a bogus file at src/main/webapp/WEB-INF/classes/dumby.txt to force MyEclipse to create the WEB-INF/classes dir in the output folder and actually output the .classes and resources correctly - otherwise nothing is outputted.
7) create a deployment for for my app container
8) clean the project and let it auto build.
The problems I have, besides the fact that MyEclipse has bugs and the maven integration is not straight forward, is that src/main/resources is not filtered for the native MyEclipse Java Builder, ie the output to myapp-web/target/myapp/WEB-INF/classes. The Maven Project Builder that is enabled compiles and processes resources to target/classes - which doesn't do me any good if I am trying to get MyEclipse to build an exploded war dir and it is already compiling the java files anyway (why compile twice? once for the Maven Builder and once for the Java Builder). Additionally MyEclipse will not resource filter webresources that would occur during Maven's package phase, so your web.xml is not filtered. Additionally, even though no filters are set for the output directory the Wicket .html files found in the src/main/java dir do not get outputted to the output folder. How do you output the .html files to the output folder? What is the purpose of the Maven Project Builder? Why not just exec the maven goals as needed when you want to invoke maven? If the Java Builder is already compiling the classes and I cannot utilize the filtered resources in target/classes without invoking the package phase to move them to target/myapp/WEB-INF/classes, then why enable the Maven Project Builder?
So although MyEclipse can 'integrate' w/ Maven projects to some extent, it is not without problems, intuitive or seemless. IntellIj works extremely well with Maven in comparison.
Is there a better best practice for importing Maven projects with goals of developing with Wicket, auto building and hot deploying with debugging enabled? Is this what others are doing?