0

I'm playing on a Java EE application using heavily javascript, a RIA application. Do you have any tip/best practice about speed up javascript developing process instead of change javascript, build a .war and deploy the app on the AS to see if my javascript is fine?

5
  • 2
    Pardon, but you do !!!install!!! (are you sure you know what this build phase does?) and redeploy? You should run the application from your IDE with auto-publishing. Simple refresh in browser is enough to see changes in static files, such as .js. Commented Jan 16, 2015 at 10:57
  • Well, it depends on how their build is configured... :) However it seems quite inefficient to do a full maven build for each js change... Commented Jan 16, 2015 at 11:05
  • @PavelHoral yes I know and you are right. Better if I change my question "... do mvn clean install..." in "... build war ...". Commented Jan 16, 2015 at 11:17
  • I still think you don't know what mvn install does (installs built artifact in your local repo ~/.m2). But you made it off-topic now :). Commented Jan 16, 2015 at 11:31
  • 1
    I like Pavel's answer the most, but whenever I need to directly test javascript code in a Java web project, I tend to setup a basic test HTML file first and then do javascript debugging work there before I integrate it in my main application. Just take Java out of the equation until you're ready. Commented Jan 16, 2015 at 14:18

3 Answers 3

2

Seeing other answers I feel like I have to write this: Just run the application from your IDE.

For example with Eclipse+Tomcat your changes will be automatically published without the need to rebuild or redeploy. You can even use tools like spring-loaded (or more advanced but commercial JRebel) to have Java class live-reloading as well.

Sign up to request clarification or add additional context in comments.

Comments

0

I have had good experiences using some lightweight AppServer like Jetty. You just need to put a starter somewhere in your project (for example in a test-project that doesn't deploy to the endsystem).

Then you can even configure what to deploy on the small server, for example, make a starter for each small module you might work on. Then, if you have proper dependency management, you can inject "fake" dependencies for third-party services and have a really fast and easy to use environment.

However, setting up such a solution is not something you can do in a few minutes, but once you have it, it will save tons of time!

2 Comments

You suggest to split the application, do I understand?
No, just to have modular launchers that allow deploying small parts on a Jetty server, so you can test small parts. This is a widely used practice...
0

Consider using a small proxy-server (apache, nginx) to run on localhost:8080 and use it as a proxy for your application, with one exception: the javascript/frontend code which you point to your workspace.

In nginx for example, you would use the location directive to configure this. See also: http://nginx.org/en/docs/beginners_guide.html#proxy

example configuration:

server {
    listen 8080;
    location / {
        proxy_pass http://<application server> ;
    }

    location /js/ {
        root /<path to javascript>;
    }
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.