slight url mismatch while publishing java 6 maven webapp to tomcat from netbeans - eclipse

Honestly I've started this small maven webapp using eclipse 3.6 (STS) and i found it so complicated that i had to switch to netbeans.I really wanted to use eclipse but these are reality on the ground.So at the end of everything I'll like to have an eclipse version of the same project. thanks
I set up the maven webapp using the embedded archetype, and use cargo plugin to take care of the deployment.basically there is only hello world index.jsp in the project.after picking pom configuration here and there my pom finally is like this .
while it started publishing after i restart the IDE, it's publishing to http://localhost:8080/ but for me I'm expecting it at http://localhost:8080/mvnTestWebap
so here are my questions
Question 1 : How can i correct that?
Question 2 : I believe my pom is tied to netbeans too much, how can i achieve the publishing to tomcat result but having a portable pom?Can anyone suggest a rewrite that can run on eclipse?
Question 3 : what correspond to netbeans "run" in eclipse?

probably by some deployment descriptor editing.
don't really understand the point. by default netbeans uses it's own embedded IDE way of deployment. That's not creating a pom tied to netbeans in any way. You can use that in eclipse or IDE or command line to build the project. The deployment part of the web app is specific to the server being used and the IDE being used.
You can also tell netbeans to execute your cargo plugin on executing the Run/Debug/Profile action (bypassing the netbeans default behaviour)
run basically performs a redeploy of the app on the server of choice. There has to be an equivalent on eclipse.

Related

Apache Wicket Quick Start

I was trying to start learning about Apache Wicket (as it looked like an easy to use UI for Java) and as I like to work with Eclipse and Maven. I also like to work with Tomcat, however, Wicket seems to prefer Jetty at least in its tutorials. I do not know nothing about Jetty, however should not take ages to learn.
I tried the Wicket Quick Start and successfully imported the generated Maven project to Eclipse workspace.
But errors appear: e.g.
import org.eclipse.jetty.server.HttpConfiguration;
It seems Eclipse cannot find the jetty server classes. How to add these to the Eclipse project?
Does the creater of the Wicket Quick Start assumed that Jetty is already installed on the machine?
I installed it. However: what is the recommended way to make what jar file available to a maven project to have jetty server classes available? I would assume via the pom.xml but I doubt that is the case here - the given pom.xml would contain it.
Or is there some special plugin for Eclipse (Photon)?Run-Jetty-Run?. I wasn't brave enough to try that.
I would love to get the Wicket Quick Start running.
I also tried Eclipse + Tomcat + Apache Wicket Maven Setup with Hello World Example but it seems that it is outdated. I was not able to install qwickie to Eclipse as described.
I am using Eclipse Proton with Java 10.0.2 on Debian Stretch.
If you are using https://wicket.apache.org/start/quickstart.html then you can start the application these ways:
mvn jetty:run - this will use jetty-maven-plugin
Open in Eclipse src/test/java/com/example/Start.java and run it as a normal Java class with a main(String[]) method. This will use Jetty Maven dependencies to start an embedded Jetty server.
Wicket's Quickstart prefers Jetty because Jetty developers made it easy to use it in non production way, i.e. in development mode, for faster dev cycles. No need to build a .war file and deploy it.
On the other side Tomcat devs (disclaimer: I am a member of both Wicket and Tomcat teams) never spent time in this direction. Tomcat's Maven plugin has been abandoned long time ago. The best integration for starting embedded Tomcat is provided by Spring Boot project (I recommend it if you use Spring!).
So, just remove the Jetty related dependencies and plugin in pom.xml and the Start.java in src/test/java/.... Then you can continue developing with Eclipse and Tomcat the way you like to do it.

Maven Eclipse Integration

I have recently started out on Maven. I am trying to integrate Maven+eclipse(Juno)+tomcat7.
I have downloaded m2e-wtp plugin for eclipse and created a Maven project whose structure follows a standard Maven project structure. It is also configured a dynamic web project.
It is a multi module project with two modules of flex(f1 AND f2) and one module of webapp(w).I have configured all the plugins correctly and there is no problem with configuration of POMs.
What I want to achieve is :
When I clean and Build project in Eclipse using Project-->Clean,Eclipse does not build the war in target folder of my web application project (w). I also does not copy any of the flex resources to target folder. However,
When I run the project as maven build by right-clicking the web application project and running it as a "maven install" it creates everything as expected.
My question is that if it is possible to achieve what I mentioned in point (1)? Or the only correct way to do this is the way mentioned in point (2).
I am also not able to deploy the generted files in step 2 automatically in tomcat.
Do I need to use another maven plugin for this?
Please note that this i my first experience with Maven + eclispe. I have followed certain tutorials. So, Please be lenient while voting negatively.
From what I know it is not possible to force Eclipse to use Maven directly (I would gladly be proven wrong).
Eclipse does not use Maven to build (1). Using the m2e plugin, it is possible to run maven to perform the build as you discovered (2).
If you are looking for that kind of tight integration you can look at NetBeans or IntelliJ who are using Maven natively.
EDIT:
About (3) there is a Tomcat-Maven-Plugin that can deploy the WAR file created on a running tomcat instance. Check the Usage page for more details.

Eclipse juno deployment requires clean and build everytime

I have a web application developed in Eclipse Juno, I am using Tomcat 7.0.32 as a web server. When ever I'm doing small changes and deploying the application, changes are not taken by the tomcat.
Under Eclipse tomcat deploy path wtpwebapps, I have found the following:
Few/all JAR's given in the build path are missing
Recently compiled java files are not updated
These things led into ClassNotFoundException sometimes and Unexpected functionality sometimes.
So, when I do clean and build the project for small changes every time,deployment works fine. But clean and build takes more time
Is it a problem with eclipse deployment plug-in? Help me out to overcome, thanks

Implementing simple modules or extensions for axis2 as an eclipse project

I wish to setup an eclipse project for implementing a simple module but not a service for axis. I wonder if there're any templates I could use?
Secondly, I would like to ask if there are any information sources such as links around on how to build complex Axis2 applications in eclipse mainly focusing on module building as well
I appreciate your hints.
Best regards,
Alex
I could come along with this issue with my own solution:
Using an customized build.xml based on axis2 module builds I am able to build a module project in Eclipse using ant. I trigger this via key shortcut.
The build.xml has an deploy.module target that puts the module back to the axis2 $HOME/repository folder. Running there ant build.xml will deploy axis2 at whole as an war-file (EAR) the module containing there within to be ready to deploy in a container such as jboss.
The eclipse project is based on common java project (no dynamic web project) containing the $AXIS2/lib in CLASSPATH.
Since Jboss supports hot deployment on update, you can run jboss in a terminal or withing eclipse. I customized the latter build.xml to support easy jboss deployment.
This is a good solution for me.

Can't get compile on save / hot deploy feature to work with maven based webapp in eclipse or netbeans

So our new webapp project is based on maven. I'm really liking the dependency management and IDE agnostic approach but I'm having problems with compilation and debugging.
Here's how I would currently get a clean copy of the project working
Check out the main project from SVN
Open the project in IDE (I've tried in eclipse 3.4 and netbeans 6.7)
The IDE will automatically open two subprojects one being the webapp, the other being a supporting utils jar.
From the command line I run mvn war:inplace on the webapp module which builds a working copy of the webapp with all dependencies in WEB-INF/lib/
This then runs fine but whenever I change a java class I have to clean and build / reload the app context.
I've googled high and low but no one seems to be complaining about this so I guess there must be something really obvious I'm missing. How is everyone else handling incremental compilation and hot deploy with maven?
To clarify all I'm looking for is the replicate the behavior I used to have before maven where I could make simple changes to java classes and they would be instantaneously compiled and hot deployed to a running webapp. I don't need anything fancy like jRebel etc I just want the new tool to give me the same functionality I enjoyed with my old tools.
If you can use mvn jetty:run it will read the classes and resources directly from the project. Using Maven2 Eclipse plugin and running the server embedded in Eclipse has auto-publishing, which gets you there in the end, although it's slower. And JRebel starting with 2.0 (as you may know) can map the Maven module directly to the deployed application, so you get instant build and redeploy. Those are the only solutions I know of.
Netbeans should support it out of the box. Though, there remains a bug related to this: http://netbeans.org/bugzilla/show_bug.cgi?id=177230
In-place deployment works for me with Netbeans 7.0.1 and Tomcat 6.0.x if I use Tomcat 7.0.x in-place deployment doesn't work. Tomcat always copies application to $CATALINA_HOME/temp :(