12

We are developing a single-page application (SPA) in which the front end is developed using AngularJS and the business logic is developed using RESTful Web Services with JAX-RS.

We are using Eclipse as IDE, Maven for dependency management and build automation tool and Tomcat as the development server. We have installed AngularJS Eclipse 0.4.0. I am a newbie to Eclipse and am running into these issues:

  1. How do I create a Maven based AngularJS project in Eclipse?

  2. Is there any way to scaffold an AngularJS application in Eclipse (just like Yeoman)?

Jens Piegsa
  • 7,399
  • 5
  • 58
  • 106
Sabarish
  • 141
  • 1
  • 2
  • 8

1 Answers1

16

Short answer:

Look for my long answer to think differently. There is a reason why you are not finding many formal popular Archetypes.

Maven Archetypes for AngularJS Maven Grunt Plugin

Long Answer:

I would advise you against mixing and encourage to treat them separately for "cleanliness" and also from architectural point of view.

Treat them as 2 separate applications.

Here are the reasons why

Builds & Tooling - The Java side tooling will not catch up with the Web/Javascript. SPAs are full fledged applications and tend to have their own development workflow. Hence working with build tools such Grunt/Gulp will make things more easier than if the server side Java (or other JVM lang) you are going after.

SPAs with and with AngularJS are more of a norm on node based build tools. Going forward you will find plethora of tools in this space than Java based tools for Javascript/HTML application.

REST Architecture style The REST architecture style you are already making conscious decision about the separation. Think Server applications are serving entities (states). The UI application is presenting.

Freedom with Development Cycles You can develop and release your UI SPA separately on a totally different release cycle. This is a great freedom. This freedom also comes with slight costs i.e. versioning and hardening interfaces which you can overcome with JSON schema and API versioning. One example about JSON schema is that you can use Jackson Schema generation https://github.com/FasterXML/jackson-module-jsonSchema of something similar that can make the schema available during build/development time. Also look at http://beanvalidation.org/1.1/ and declare your Bean Validation constraints such as (Required, Type, Format, etc) and go for declarative approach. Then you can export this to a JSON schema easily.

bhantol
  • 9,368
  • 7
  • 44
  • 81
  • 1
    Thanks for such a detailed response... I have been desperately googling for Maven based AngularJS application in Eclipse and have not found a decent solution... – Sabarish Aug 12 '14 at 17:01
  • Could you tell me why you "have to" go with one app in Eclipse i.e. any constraints - perhaps I can try to point towards workarounds. – bhantol Aug 12 '14 at 17:03
  • Thanks .. There is no constraints... We were developing Angular JS applications using Microsoft Stack [ ie Angular JS + ASP.NET Web API]... A new client wants a new SPA developed in Java Stack . The Java team in our company uses Eclipse. From your comments i think I think Grunt/Yeoman/Bower could be a the best combination for front end development... However would be a great help if you can guide me on the following - the IDE to be used . we are planning to use Jasmine / karma for BDD.. is this a good choice and the CI that will be used is Jenkins... Will Jasmine / karma work with Jenkins – Sabarish Aug 12 '14 at 17:07
  • We are using WebStorm from JetBrains and very happy. However I am looking for Apatana Studio or Aptana Eclipse Plugin as well. Thinking that one IDE may be better to avoid upgrading developer work stations to be able to run both at the same time but again we are in same boat as you. I gut feeling is to stick with WebStorm. – bhantol Aug 12 '14 at 17:30
  • My gut feeling is to stick with WebStorm but haven't looked at Eclipse alternative fully. – bhantol Aug 12 '14 at 17:31
  • What about testing.. Is Jasmine / Karma a good choice... from the documentation it seems that Karma can work with Jenkins – Sabarish Aug 12 '14 at 17:38
  • Good for unit level testing. Can't go wrong with mocha either. However we have difficulties keeping up with coverage. Felt like we could cover some protractor based e2e tests also. HP UFT automated testing seems is very "blackboxy". – bhantol Aug 12 '14 at 17:43