I'm new to Angularjs and i'm trying to run first angular program with Spring. I downloaded the code from here: http://javahonk.com/spring-mvc-angularjs-integration/. Imported it as a maven project. Downloaded JSDT and AngualrJs plugin from eclipse marketplace but it's still not running. There is no error message. I'm running this on tomcat 7. What am I missing?
Any help would be appreciated?
I'm not a Eclipse user. so I have no idea for that. But you can use nodejs as a static server. it is explained here
1) Install nodejs for your OS
2) Run this command in a terminal (console)
> npm install http-server -g
3) Start server
> cd /path/to/your/project
> http-server -o --cors
Now you can access your project from browser http://localhost:8080/yourfile.html
Work in Eclipse and just refresh page on browser to see changes.
If you are working on a Spring Application within Eclipse IDE, your best alternative would be to start you appliction using an embedded Application Server (Best I would recommand are Jetty or Tomcat if you ain't need EE level components).
You can follow this link, which holds basic steps for adding a new Application Server within Eclipse IDE.
Once you have added a new application server, you can deploy your application in it then launch it and you should have your applcation reachable at http://localhost:8080/SpringMVCAngularJS.
A good alternative when using Maven as a build tool, is using an embedded AS plugin such as Tomcat7 Plugin or Jetty Plugin. This plugin will provide the ability to start your applcation using the Maven different goals (which does not require adding a new AS into Eclipse IDE).
I've pushed a sample module based on the tutorial you mentioned. YOu can test the above described plugin as follows in a *nix shell (You may need to setup git if not already done):
git clone https://github.com/tmarwen/stackoverflow-showcase.git
cd stackoverflow-showcase/springmvc-angularjs
mvn tomcat7:run
Related
I was wondering if IntelliJ has a built in Application Server (like Tomcat) that I can use without having to download Tomcat directly?
Right now when I go to Run | Edit Configurations, Defaults, Tomcat Server, Local, it asks me to specify the Tomcat home directory.
Previously I had used myEclipse and it came packaged with a Tomcat so I would be suprised if the ultimate version of IntelliJ does not have this.
Intellij does not include built in application server. It has simple web server they refer to as Webstorm. However it is not application server.
Here is excellent resource (official docs) for working with application servers in intellij which you may find to be useful including tips on integrating it IDE via plugins etc:
Working with Application Servers
You need to download an application server manually.
Or you could use a Maven/Gradle dependency to start Tomcat programmaticly from the Main method, or a plugin for starting it via command line e.g. mvn tomcat:run.
I've got a Java web application that builds with Maven. My project uses RequireJS. I use a maven plugin at build time to compress the JS artifacts (https://github.com/bringking/requirejs-maven-plugin). The plugin calls out to NodeJS (with the r.js compressor) to do the actual work.
Local builds work wonderfully.
On Heroku, however, NodeJS is not available using the Heroku Java buildpack (the default for Java/Maven applications).
For now, I run the requireJS maven plugin locally using an active Maven profile that isn't present on the Heroku server. This prevents the RequireJS plugin from running on the Heroku server. This is less than ideal because it requires me to run the plugin locally, then check in the resulting build artifact. It's far better to generate the compressed JS file at build time in the Heroku system.
I'm looking for a good solution. Thanks in advance.
The best solution is to use Heroku Multi Buildpack with the Node.js and Java buildpacks. This is described in an article using Grunt with Java and Maven but the same principles apply for Require.js.
we recently migrated to Maven Build manager & git hub repository for our Java web-app. Also i switched to eclipse as eclipse has good set of plugins.
As a new bie, i am simply running mvn clean package from terminal at the code root directory. And then moving the compiled code i.e., /target/SNAPSHOT/* to tomcat/webapps/ROOT location.
And then starting Tomcat7 server. The process is time taking especially when i do code changes in Java & configuration .xml files.
I want to do it completely in IDE environment as i did earlier in Netbeans, update code -> build and run in debug mode, -> do code changes and then commit.
Heard of egit & m2e in eclipse for maven & github integration, but not sure how to use it.
Please walk me through the steps required in doing so. I am completely new to eclipse.
--
Thanks
You might want to consider using maven-jetty-plugin http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin for running the webapp. You will not need to copy over stuff to tomcat. After configuring this plugin, you can simply run your application by doing mvn jetty:run
I generally do not like running webapps inside Eclipse. It's a personal prefrence, but it is always nice to have an IDE neutral way of building and running your applications. If you have m2e things should work simply fine. I have seen maven-jetty-plugin having hot pluggability where if you changed your web.xml, jetty would reload your application.
We use Git for version control and Maven for dependency management and build automation. Once your project has successfully imported into Eclipse and recognized as a valid java web project, you don't need either Git or Maven in order to build/run it inside IDE. Just creat a server using you existing tomcat installation, add the project to server, then select Run as > Run on Server.
The Complete Guide:
Creating a server
Adding projects to a server
Starting a server
For more details, check out Testing and publishing on your server.
Currently I'm developing project with GAE/GWT. I'm using IntelliJ IDEA CE so there's no simple way of doing GWT development (it doesn't contain GWT plugin). However it seems to be possible to run the GWT server in development mode, so it will be able to pick up the changes made to classes.
There is some solitions to make IDEA CE GWT-friendly, like http://java.dzone.com/tips/gwt-development-intellij-idea. However nothing about GAE+GWT.
So now I'm looking for the way of starting GAE application (mvn gae:run) with having GWT in development mode. Can you please advice?
So what did I do in order to get it working:
1) add output directory settings so maven will generate files in place where GWT will expect them:
<outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/classes</outputDirectory>
2) configure maven-gwt-plugin to respect your GAE app home
<extraJvmArgs>-Dappengine.sdk.root=${appengine.sdk.root}</extraJvmArgs>
3) configure maven-gae-plugin to provide correct paths for GAE home
<configuration>
<sdkDir>${appengine.sdk.root}</sdkDir>
<jvmFlags>-Dappengine.sdk.root=${appengine.sdk.root}</jvmFlags>
</configuration>
4) set the property to point to the home of GAE installation:
<appengine.sdk.root>/path/to/gae/home</appengine.sdk.root>
and then you will be able to run the server
mvn gwt:run
as well as debug it
mvn gwt:debug
works fine with IntelliJ IDEA CE 10, but don't forget to run
mvn war:exploded
after every "mvn clean" task
Just add following lines to gwt-maven-plugin configuration:
<server>com.google.appengine.tools.development.gwt.AppEngineLauncher</server>
<appEngineVersion>${gae.version}</appEngineVersion>
<extraJvmArgs>-Dappengine.sdk.root=${project.build.directory}/appengine-sdk/appengine-java-sdk-${gae.version}</extraJvmArgs>
Then run your application as usually - mvn gwt:run
In our project we use this steps - first run maven task -
mvn gae:debug and the second is remote connection on specific port(5005) to specific address.
If you required more explanation please welcome.
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