eclipse default build and ant build - java

Cntrl+B( or clean-> build) will build complete java project under eclipse environment. Is this build uses project which is configured default build or it builds based on the eclipse plugin?
one of the java application I have seen is eclipse build will build complete project and depoy in the tomcat directory. How this is happening?

You might have seen the deployment feature with an Eclipse configured with WTP (Web Tools Platform).
WTP is featured in the Eclipse IDE for Java EE Developers and Eclipse IDE for JavaScript Web Developers, and contributes to many of the other Indigo packages.
WTP is able to deploy an app in a Tomcat (or in a local Tomcat within Eclipse itself).
See also "How does eclipse deploy web applications using WTP?"
You can see an example a a build and deployment in "HowToSetupEclipseWtp".

Related

How I can debug the installed eclipse plugin

I have installed some JAVA plugin to the Eclipse. This plugin does not provides the source files (as this plugin contains only a set of JAR files). So, right now I want to "reverse engineering", to debug this plugin (to understand how it does work).
I know that I can run the Eclipse (which includes this plugin) in a "server" mode and then it will wait the remote 'GDB' connection.
Also, I have heard that I can use the Intellij IDEA as an IDE to remote debugging, to debug that Eclipse (with its plugin). But a main issue is that I have not a sources of that Eclipse plugin and I can't open it in Intellij IDEA.
So, my question is: is it possible to debug the eclipse JAVA plugin which has not a sources? And, if yes, then, how I can do it?
BR,
Denis
Using Intellij IDEA for this is nonsense--this is little different from debugging a plug-in when you do have the sources available, and plug-in developers have to do that all the time.
1) Install the Plug-in Development Environment. It's found in the Eclipse Project update site you should already have built-in.
2) Import the plug-in into a project in your workspace. Be sure to look for
3) Launch an Eclipse Application using a different workspace from the Debug menu.
This essentially takes what's in the Target Platform preference page, adds the plug-in from your workspace, and runs a copy of Eclipse with all of that mixed together. It's a different JVM process and should have its own workspace directory.

How to add external jars in Eclipse

I'm unable to successfully add and use these external jars from my Eclipse Repository.
org.apache.felix.dependencymanager.annotation-4.0.3
org.apache.felix.dependencymanager.runtime-4.0.2
org.apache.felix.dependencymanager.shell-4.0.3
org.apache.felix.dependencymanager-4.2.0
I get no errors at the Add Files to Repository window:
I, however, get an error warning pop-up window after clicking on the Finish button.
'Building Workspace' has encountered a problem
Errors occured during the build.
I then get the error below whenever I add them from the Available Bundles tab into the Run Requirements tab and then try to resolve the Run Requirements (even though I have added all the jar).
org.osgi.service.resolver.ResolutionException: Unable to resolve <<INITIAL>> version=null: missing requirement org.apache.felix.dependencymanager
How can I successfully add and use these jar files to my project?
Eclipse
Eclipse Java EE IDE for Web Developers.
Version: Mars.1 Release (4.5.1)
Build id: 20150924-1200
Java:
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Eclipse Equinox is the OSGi framework developed in the frame of the Eclipse foundation. Deploying on the Eclipse platform means deploying OSGi bundles in Equinox.
You are using Apache Felix, which is the OSGi framework developed in the frame of the Apache foundation.
According to your explanations, it seems you are trying to install Felix as an Eclipse bundle:
[...]add and use these external jars from my Eclipse Repository.
If you wish to develop an Eclipse project which would be deployed as an OSGi bundle in the Apache Felix framework (and not an Eclipse plug-in project), the Felix Documentation details how to integrate Apache Felix with the Eclipse IDE. It seems in this documents snapshot are out of order, but the general procedure should be right. Three ways to include the Felix runtime are specified, an Eclipse repository does not seem to be the right way.

How can I run a GWT app from gwt-maven-plugin without any browser plugins?

For a GWT application which I build with the GWT Maven Plugin (gwt-maven-plugin), I can run the GWT Development environment with
mvn compile war:exploded gwt:run
and then launch a browser. This requires that the browser provides the GWT Developer Plugin. (Firefox 6 for example does not yet support the GWT Plugin).
Does the GWT Maven Plugin also allow to simply run the included Jetty container with the GWT application, without a development mode?
After configuring gwt-maven plugin you could simply run the following.
mvn jetty:run-war
After gwt compilation the resulting war will be placed in jetty and started via Maven Jetty Plugin.
The only way to run the project without plugin is to compile it and run on a server. If you are using Netbeans just hit run. The IDE will compile and deploy project on a server. In other way just compile it with the following command (you can omit tests and reports):
mvn clean:clean resources:resources compiler:compile war:exploded resources:testResources compiler:testCompile surefire:test gwt:compile war:war
After this you 've got ready to deploy war file. To deploy it to the Glassfish there are now basically three options:
Maven GlassFish Plugin
A first option would be to use the Maven GlassFish Plugin. This plugin allows to interact with a local or remote GlassFish install and the management of Glassfish domains and component deployments from within the Maven build lifecycle.
Maven Embedded GlassFish Plugin
The second option would be to use the Maven Embedded Glassfish Plugin. As stated by its name, this plugin doesn't rely on an existing install but uses an embedded GlassFish, running in the same JVM as the plugin. This plugin is extremely nice if you want to keep your build portable (anybody can get your POM and run a build involving GlassFish without having it installed) with almost the same features as a normal GlassFish install, except clustering of course (you can use a preconfigured domain.xml if you want). See Testing with the GlassFish Maven plugin and JavaDB Embedded for an example.
Maven Cargo Plugin
The work initiated by Kohsuke Kawagushi as been finally integrated in Cargo and, starting with Cargo 1.0.1, GlassFish 3.x is now supported. Using the Maven Cargo plugin is thus a third option. This would be interesting for builds that want to interact with containers in an agnostic way. But I'm not sure Cargo allows all the flexibility of the GlassFish specific plugin(s) (e.g. deployment of JMS resources, etc).

deploy multi-module maven project to Tomcat from IDE

I have a mutil-module Maven project wherein the pom's have the following packaging types
pom
|--jar
|--jar
|--war
The war project depends on jar projects. I imagine this is a pretty typical setup for a webapp built with Maven. I can deploy and debug the project by
running mvn install
copying the war to Tomcat
starting Tomcat in debug mode
from the IDE, connecting the remote debugger to Tomcat
Obviously, performing these steps after every change, quickly becomes a pain. Is there a simpler way to build and deploy the project to Tomcat, such that it can be debugged from the IDE? Instructions for either Eclipse or IntelliJ (ideally both), would be welcome.
In case it makes any difference, I normally create the Eclipse project files using the m2eclipse plugin. In intelliJ I use the import maven project feature.
Thanks.
If you install the m2eclipse-extras (wtp support) you will be able to configure tomcat server within eclipse and deploy the applications from within eclipse. This will also watch the project for changes and automatically redeploy. This might not work well if it is a large application.
The other approach is to use the maven jetty plugin or the maven tomcat plugin that runs it as a web-app without requiring to build a war.
You can also look at jrebel (a commercial tool) that can load the changes to class files / cofiguration without requiring a redeployment.
How about tomcat:run-war-only?
m2e is between maven and eclipse (Tomcat is not involved here). Choose "Build Automatically" (make sure there is nothing under "Problems" tab. If it is,just delete the errors entry from "Problems" tab). This will compiler and convert everything to .class files.
wtp is between eclipse and tomcat (servers in general) for deployment.
m2e-wtp is like a bridge used for deployment of maven projects in tomcat

Debugging Maven Web Application on already installed Glassfish using eclipse

My problem is with respect to debugging web application on an already installed glassfish using eclipse.
If I create a web project using eclipse then eclipse will let be deploy and debug application on an already installed glassfish application server. However, if I have created a web project using maven archetype, eclipse does not let me debug the application.
I can use maven's jetty or tomcat plugin and debug the application but I need to debug application on an already installed glassfish. Basically I have followings
1) Web application created using maven archetype
2) Eclipse IDE
3) Glassfish which is already installed outside of Eclipse IDE
I came across maven's glassfish plugin but as far as I understood it is not for debugging the application.
Please let me know your suggestions.
Thanks
If I create a web project using eclipse then eclipse will let be deploy and debug application on an already installed glassfish application server. However, if I have created a web project using maven archetype, eclipse does not let me debug the application.
This is not true. Whether you use the Maven Eclipse Plugin (which provides WTP support) or m2eclipse (with the optional Maven Integration for WTP installed from the m2eclipse Extras), you can deploy a project created outside Eclipse to an existing "Server" (that you can start in Debug mode), as long as you imported it appropriately (Import... > Existing Project into Workspace if you use the former, Import... > Maven Projects if you use the later).
Basically I have followings 1) Web application created using maven archetype 2) Eclipse IDE 3) Glassfish which is already installed outside of Eclipse IDE
I use the same setup with several projects with no problem (and can debug them on my locally installed GlassFish server).
I came across maven's glassfish plugin but as far as I understood it is not for debugging the application.
There is no need for extra Maven plugins, you can just rely on your IDE if you follow the right steps.
I don't know about eclipse, but IntelliJ IDEA has a remote debug feature. You start your server with something like
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5055
and then the IDE will connect to that port and you'll have a regular debug.
I'm sure eclipse has this feature.
EDIT: This article shows how to use this feature with eclipse.
I´m going to write it most for me in order to keep trace of my solution:
If you are using the maven.failsafe plugin just force the execution of glassfish internally the current JVM started by maven avoiding the fork with the parameter
-DforkCount=0
in such way you are able to debug both test and server from the usual way, ie. running a debug task from eclipse and setting break points both in test and in server side.
Extra parameter information could be found here, including setting different debug port:
http://maven.apache.org/surefire/maven-failsafe-plugin/examples/debugging.html

Categories

Resources