Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven based AngularJS application in Eclipse

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)?

like image 706
Sabarish Avatar asked Aug 12 '14 16:08

Sabarish


People also ask

Can we use Eclipse for AngularJS?

AngularJS Eclipse Plugin extends Eclipse WTP to provides an HTML editor which supports AngularJS expression and directive. It provides an Angular Explorer view which displays modules, controllers of your project in a tree. It also provides a Javascript editor which supports AngularJS features (modules, etc).

How do I run an angular project in Eclipse?

In Eclipse go to the menu: File->New->Project. Select "General->Project" and click on the next button. Right-click with the mouse on you're new project and click "Configure->Convert to AngularJS Project.." Enable you're project goodies and click on the "OK" button.

Is Eclipse good for angular?

Angular IDE is developed especially for the Angular framework. It is accessible as a stand-alone plugin as well as with an Eclipse plugin. This is the best free (integrated development environment) IDE as it is simple for beginners to learn and gives more power to Angular experts.

Can Angular JS be used with Java?

One way is to build Angular with Java. In the development phase, we can run Angular and Java on separate ports. The interaction between these two happens with proxying all the calls to API. In the production phase, you can build the Angular app and put all the assets in the dist folder and load it with the java code.


1 Answers

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.

like image 139
bhantol Avatar answered Oct 26 '22 22:10

bhantol