How to create an application from a Maven file?

Asked

Viewed 103 times

6

I was working with EJB and dealing with four simple Maven projects, a web project ,a desktop project (JSE Swing), a project (JSE) that had only the interface and ultimately a web project (which I called Core) that implemented this penultimate interface-owned project.
The business rule at first was quite simple a Hello Brother that printed next to this message the name of the user that was received by parameter. This was a very simple program that even a child with a smile on his face could understand.
I was using Glassfish application server. The "Core" project that contained the implementation of the business rule was the first to be deployed and the other two consumed this service through a remote interface.
So far so good I implanted and tested all of them and they worked! The Swing , the web all legal !

Moral of the story:

Although simple it took some work to build it, that is, I had to create manually one by one, I wrote a single business rule, which saved considerable time, thanks to the EJB. My teacher a very nice guy created the same project using Maven , using only three command lines via terminal.
I have no idea what he did! I would like an explanation of how it is possible to do this!! Writing only the business rule and terminal with Maven!!

  • if I understand well you want to know how to generate a project with Maven? Or you want to generate the business rules with Maven also?

  • @Thanks for your kind attention! What I want is to create the same simple business rule and generate the 4 projects cited in the question of a single blow with the Maven, automatically!

  • Want to replicate the business rule in 4 different projects? Or want to create 4 different projects in the same command?

  • So one project (JSE) is left with just the interface , another with the implementation (Java web , which I call the core) of this interface and the other two (a web project and the other JSE) consume the service of the project that implements the interface, both seek in the core project what they need!!

1 answer

2


Your teacher can have used a Archetype of Maven, that is, an archetype, prototype or design model.

Archetypes are actually special Maven projects that can be used to generate Maven projects.

An Archetype works as a template. It is even possible to have variables in the files, so that when creating a project you inform the value of these variables and the files are processed with the new values.

The great advantage of using Archetypes is having the basic structure of a certain type of design without having to pay attention to every detail. This is particularly advantageous for projects based on commonly used technologies or to standardize the creation of projects in companies, which can keep their Archetypes in an internal repository.

On the other hand, some Ides like Eclipse, Netbeans, and Intellij also have some project models, but they are usually not compatible with Maven. This creates a lot of confusion for those who start using the structure created by the IDE and then want to migrate to Maven or some other tool build, mainly because the directory structure is usually different.

  • Thanks man ! Please , could indicate some tutorial to teach you how to do this?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.