IntelliJ Maven WAR with Chrome Developer Workspaces - java

I'm trying to use IntelliJ to do my web development.
With Eclipse I didn't use a Maven build and simply changed between Chrome Dev Tools and Eclipse when I would need to switch between frontend and backend changes and was able to map the Chrome workspace to a static webapp folder that wasn't part of a Maven build.
Now I've switched to IntelliJ (mainly for its Java tools) but now I'm unable to use it alongside Chrome Dev Tools.
I have the 'Update Resources' on frame deactivation set, which works if I edit a local javascript file and then move away or save the file, but if I try to use Chrome Dev Tools Workspaces to save it, obviously IntelliJ doesn't pick up that the file has been externally updated and therefore doesn't update the file in the exploded WAR.
Is there some way I can do these together? I like a lot of things about IntelliJ for Java development, but I find that Chrome is far and away the best IDE for Javascript/CSS/HTML changes and would like to use it alongside IntelliJ.

I found it is much easier to simply compile the web app in place into WEB-INF rather than using maven. You can still use maven for dependencies but just ignore the maven lifecycle for local development. It's not necessary for local development and adds time to the compilation/deploy process.
Let me know if this is a bad idea. It has worked quite well for me.

Related

SpringSource integration with eclipse

I am attempting to integrate the sonarqube plug-in with eclipse. However, I want to do this on another machine that does not have network access. I have copied the .jar files into the Spring plugins folder. This does not properly install it.
I was wondering how I can go about this installation process?
Thanks
Doing a copy of plugins JAR is not a good idea. You will miss some items (especially features, config, ...).
You could download the update site content from http://downloads.sonarsource.com/eclipse/eclipse/ and then copy it to your offline computer and configure a local update site (file://xxxx).

How to continuous UI development in java?

So I come from ruby on rails background.
I am working on this java project.I am fairly new to java.
I maybe wrong but It seems unlike other technologies ,one compiles the project in a war file then deploy's that on tomcat.
The original assets are in src directory that are be checked in the source directory.
Where as to make any changes in assets files that being css/javascripts/images one need to
make changes in the target directory of the tomcat to preview them on the browser.
This makes development tricky and complex as I can't use branches, since branches work on src directory of my local repository but the changes I make are in the target directory. Also I would like to use sass and haml like features in java. What frameworks or other web servers or any other strategy are my options .
I have heard of groovy on grails but for some reason we want to stick to java the language
Look into using a build tool like maven or gradle to build your project. They both have a jetty plugin with a jettyRun goal that will run your project out of your source directory using embedded jetty. So if you are making changes to the assets, you just have to refresh the browser.
Another alternative is to configure tomcat to serve your assets up as static files from your workspace while you're doing development.
Or as #DaveNewton suggested, you can use your IDE to auto deploy

Is there any guide showing how to build effectively an application with appengine and maven in eclipse?

I'm trying to develop an application using Google App-Engine and Maven using Eclipse. I am facing a problem where by whenever you change a CSS or JSP file, a restart of the application is required. This makes working quite difficult, since a reload takes a lot of time.
For example when you develop on tomcat no need for restart is required when such a change is made, only Java or xml file require restart of the server.
Is there a solution that mimics the tomcat behavior on GAE SDK when developing on localhost?
If you've built using the standard app engine maven archetype, when you run mvn appengine:devserver from you -ear directory, the exploded war working directory is located here:
<yourapp>/<yourapp>-ear/target/<yourapp>-ear-1.0-SNAPSHOT/<yourapp>-war-1.0-SNAPSHOT.war
If you change any JSPs in this directory, they will get reloaded without needing to restart the devserver.
Thus, you can set up a simple script or command that copies all your JSPs and static files from /-war/src/main/webapp to that deploy directory whenever you want your files to be refreshed. I saw on some threads where people set up their IDE (in this case IntelliJ) to automatically do that copy whenever the IDE loses focuses, which makes it trivial to get pages reloaded.
Building application with appengine in eclipse using maven is not very effective and time consuming because on every change on jsp/css/js with a traditional approach there is a need to restart appengine or mvn appengine:devserver.
#adevine make me thought about a solution, and I found this link: http://andrei.gmxhome.de/filesync/index.html wich installs a plugin in eclipse, then I activate the project to sync files from myapp/src/main/webapp to a target folder generated by maven myapp/target/myapp-snapshot-0.0.1.
It's working!!!
Whenever a change is done in webapp the files are transfered automtically(no need to run anything else, just save the file) to the target folder and are reloaded successfully.
Hope this could help people because its frustrating working with appengine(restarts takes a lot).

how to build project after code changes without mvn clean install?

I have a project in eclipse, a java app with appengine sdk and maven as my builder.
The .class files are not refreshed until i launch clean install, so every change i do in code i have to run:
mvn clean install
mvn eclipse:clean
mvn eclipse:eclipse
and then try to launch my app.
Help me please it's really annoying. Thanks
I know this is a very old post but I recently came across this issue while working with STS and Websphere application server. Hope this helps anyone to come across this ancient relic of a post.
Have a look at the "FileSync" plugin in the Eclipse marketplace. It allows to sync your workspace files with external directories (think your application server). After you install "FileSync" you can configure it to "copy/paste" your workspace files directly to your application server's exploded .war directory. It might take a little playing around with to get your files copied in a j2ee compliant format but it worked like a charm for me. Once its configured you basically just update files, save them, and your application is ready to go!
You are probably looking for a hot deployment feature. When working wit ha webapp, in most cases it is not enough just to compile a java class - usually you have to create a war package, and nearly always you have to redeploy the new code to the app server.
mvn package should be enough to create the war. You don't need to run mvn clean as long as you don't remove or rename any file. That would make things faster.
To achieve hot deployment (i.e. to get the new code instantaneously on the web-engine dev server) you need to do do some extra work, however. Make sure you use the Google Plugin for Eclipse - you can use it along with maven. The plugin at least should take care of static files hot deployment. Running the application in debug mode with Eclipse helps a bit as well as it is capable of replacing the methods' bodies on the fly.
Find further information answers to this question.
It's unclear from the question exactly what is happening and why. To figure this out, we would need to see the pom.xml and the "tree" command output showing the relevant folders and files. Then we could compare that to what the relevant maven plugin should be doing, and work from there.
As it stands, this is a quite old question in which it's unclear exactly what's happening, and OP has disappeared a long time ago. If this issue occurred today, the best thing to do would be to post to the App Engine Public Issue Tracker, although this could be inappropriate if the issue weren't in the App Engine SDK (or related maven plugins) but came from a third-party maven plugin not behaving properly (maven-compiler-plugin, for example). However, until a more in-depth analysis were performed, it would be difficult to know in advance.
Getting hot-reload of your App Engine application working is easy using only the Eclipse m2e plugin actually, and doesn't require the GPE plugin or any other special connectors:
1) Create your App Engine app as a Maven project in Eclipse as you would normally, using one of the provided Google archetypes or another custom archetype.
2) Configure your project, and do an initial build with mvn clean install in the root of the project to create the initial target/<artifact>-<version> WAR directory.
3) Start the development server with mvn appengine:devserver in the project root and ensure you can view your locally served app in a browser. Leave the development server running.
4) In Eclipse, make sure that Project -> Build automatically is checked.
Now, whenever you save a .java file Eclipse will automatically build the corresponding .class file under target/<artifact>-<version>/WEB-INF/classes. In a Maven project, this directory is set as the output directory for classes in your .classpath. The development server will detect the file change and do a hot-reload of your application so that the changes will appear immediately when you refresh your app in the browser.

Eclipse: Is it possible to publish Javascript edits to an external Tomcat instance

I am converting an application from Flex to Javascript. My workflow within Eclipse for Flex was to use Maven to start my Java web app in Tomcat and then have Eclipse configured to compile edited Actionscript files to a SWF and save it to my exploded WAR directory (that Maven/Cargo uses).
It worked very well for a long time allowing me to edit actionscript source code, flip over the browser, refresh the screen and see the changes.
I am new to Javascript however, and am struggling to get the same workflow up and running. The part I don't understand is how to tell Eclipse that I would like my edited Javascript files to be written out to a particular directory (that contains the exploded WAR). In my WAR project (a WTP dynamic web project) there is something that looks like a Javascript build path called "Javascript resources", but there is no output directory.
I would really like to continue to run Tomcat and Jetty via Maven if at all possible. I realize I can do what I want via WTP (M2E-WTP), but would prefer to use Maven/Cargo.
Denis's suggestion to create custom builder is probably best solution if you want to continue using pure Maven/Cargo approach with Eclipse.
If you are deploying to an exploded war directory, then another similar idea would be to use a File Synchronization plugin. These will automatically copy modified files to configured folders. See:
http://andrei.gmxhome.de/filesync/
https://wiki.onehippo.com/display/CMS7/Use+Filesync+Eclipse+plugin+for+faster+turn+around
-------------
FWIW, I don't think Maven:Tomcat/Cargo plugins are ideal for real-time web development, especially on the frontend side of things. They are useful mainly for controlled deployments or bootstrapping a server without initial setup. My thoughts:
Eclipse WTP used to be great for real-time web development, but I stopped using it a few years back as it just got way too hard to make it work correctly in a Maven environment. Fwiw, my preferred approach these days looks like this:
Do not install or use Eclipse WTP.
Use m2eclipse to integrate Maven with Eclipse.
Use Maven to do clean builds and generate exploded WAR directory in target folder.
Setup independent Tomcat server to load webapp from the exploded target folder.
I suspect the tomcat setup/startup could be integrated into Maven. It's not worth the extra complexity to me though.
Then, I configure JRebel (automatically via Maven) to handle java and web resource file changes. With this setup, I almost never have to redeploy or restart Tomcat. All changes (java, html, js, etc.) are seen immediately.
I think the same setup could be used without JRebel (for non-java files only) by configuring the web source folders as source folders in Eclipse with custom target output path being the corresponding directory in the exploded war directories. If that didn't work, then it would definitely work by using the custom builder or file synchronization solutions mentioned above.
Eclipse introduces the concept of "builder" to build a project. It comes with hardcoded builders such as the java compiler or the war builder of WTP.
But eclipse also enable to setup your own Builder using ant files : on your project, right click the project properties, go to section Builders, click on the new button.
You can use arguments to your ant file and use variables defined in by eclipse to build them
Do not forget to fill the refresh tab if you want eclipse to by notified of the produced files.
Do not forget the fill the Build options tab, section "Specify working set of relevant resources" in order to have your builder called each time a source used by the build file is changed inside eclipse.
Also go to the "targets" tab to specify during which type of build phase your ant file is called and which target is called.
I knwo this solution may not be the best for you since your build process will be described more than once but it may help you achieve your goal.

Categories