How to choose which Java EE version ?
by Antonio Goncalves
Hi all,
I've realized that I wrote on the forum (
https://community.jboss.org/thread/231843), but maybe the development ML
would have been more appropriate. Here are some thoughts and questions
about "how to ask Forge to generate a Java EE 6 or Java EE 7 application" :
----------------------------
Java EE 7 is out... and one day will come Java EE 8, 9 and so on. So we
should be able to ask JBoss Forge to either generate a Java EE 6 or 7
application... and if we want to be more precise, you could even go into
choosing from Java EE 6, Web Profile 6, Java EE 7 and a Web Profile 7
application. But how to choose a version with JBoss Forge ?
Today, with JBoss Forge 1.x, you create a project with a CLI without giving
any version indication :
1. new-project --named app1 --topLevelPackage org.app1 --type war
Then, when you setup your project, you give Forge some hints :
1.
persistence setup --provider ECLIPSELINK --container GLASSFISH_3
--named testPU ;
2. validation setup --provider HIBERNATE_VALIDATOR ;
If the idea is to use Forge to create Java EE applications running in a
container (and not just in standalone Java SE), the CLI to create a project
misses some information, and the setup is redundant. I would think of
something like :
1.
new-project --named app1 (...) --version JAVAEE_7 --container GLASSFISH
2.
new-project --named app1 (...) --version JAVAEE_6 --container GLASSFISH
3.
new-project --named app1 (...) --version JAVAEE_WEBPROFILE_6
--container GLASSFISH
4.
new-project --named app1 (...) --version JAVAEE_WEBPROFILE_7
--container GLASSFISH
Note that I didn't put the version of GlassFish because the version of Java
EE implies the version of GlassFish (eg. Java EE 6 == GlassFish 3, Java EE
7 == GlassFish 4). But note that you could also specify the container if
needed (e.g. generate a Java EE 6 app running on GlassFish 4)
1.
new-project --named app1 (...) --version JAVAEE_6 --container GLASSFISH_4
And, of course, the following would be illegal (GF 3 cannot run a Java EE 7
app) :
1.
new-project --named app1 (...) --version JAVAEE_7 --container GLASSFISH_3
On this comment<https://issues.jboss.org/browse/FORGE-1067?focusedCommentId=12794855&page...>,
Lincoln says that the application should only depend on Java EE APIs. So I
think the pom.xml should only contain one of the following dependency
(depending on the version of Java EE 7) :
1. <dependency>
2. <groupId>javax</groupId>
3. <artifactId>javaee-api</artifactId>
4. <version>7.0</version>
5. </dependency>
6. <dependency>
7. <groupId>javax</groupId>
8. <artifactId>javaee-api</artifactId>
9. <version>6.0</version>
10. </dependency>
11. <dependency>
12. <groupId>javax</groupId>
13. <artifactId>javaee-web-api</artifactId>
14. <version>7.0</version>
15. </dependency>
16. <dependency>
17. <groupId>javax</groupId>
18. <artifactId>javaee-web-api</artifactId>
19. <version>6.0</version>
20. </dependency>
You do not need any extra dependency if you want an application to depend
only on Java EE. So that means the following commands can also be changed
from :
1.
persistence setup --provider ECLIPSELINK --container GLASSFISH_3
--named testPU ;
2. validation setup --provider HIBERNATE_VALIDATOR ;
to
1. persistence setup --named testPU ;
2. validation setup ;
No need to specify the provider. That's because you will use the JPA/Bean
Validation/... default implementation of the container (GlassFish uses
EclipseLink, JBoss uses Hibernate...). And to ease the configuration and
portability, this means that you don't need the <provider> element in the
persistence.xml :
1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2. <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance" version="2.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
3. <persistence-unit name="javaone2013PU" transaction-type="JTA">
4. <provider>org.eclipse.persistence.jpa.PersistenceProvider</
provider>
5. (...)
6. </persistence-unit>
7. </persistence>
Nor do you use the <default-provider> element in the validation.xml (and so
on).
I think the Java EE version should be specified when the project is
created, and then all the setups would use the default container
implementation.
--
Antonio Goncalves
Software architect and Java Champion
Web site <http://www.antoniogoncalves.org/> |
Twitter<http://twitter.com/agoncal>
| LinkedIn <http://www.linkedin.com/in/agoncal> | Paris
JUG<http://www.parisjug.org/>
| Devoxx France <http://www.devoxx.fr/>
11 years, 1 month
Add means of defining constraint for Length on String
by Robb Greathouse
Hi,
Was trying to change the length on String from the VarChar(255). In Hibernate this can be done by specifying @Length(max=350) (for example.
However, there is no "constraint Length --onProperty xxx --max 350" available in Forge.
Using "constraint Max" causes forge to have a conversion error when attempting to insert string data.
Robb Greathouse
Partner Enablement
Middleware Business Unit
JBoss, a Division of Red Hat
cellphone 505-507-4906
11 years, 3 months
github pull request to issue linking
by Thomas Frühbeck
Hi,
I recall having seen github linking a pull request to the JIRA issue
automatically. With my last pull request this was not the case, did I do
something wrong?
Can you please tell me how that feature worked and why it didnt with my
last pull request: https://github.com/forge/core/issues/348?
I really would like to see that feature at the company's site too :-)
Thanks,
Thomas
11 years, 3 months
Re: [forge-dev] Gradle Addon status update - Gradle project creation working :)
by Lincoln Baxter, III
Adam,
AWESOME! And congratulations :) This is EXCELLENT!
I am very excited about this. Unfortunately, my work day just ended (after
about 11 hours,) so I need to take a break, but I will try this out
tomorrow.
I wonder, does the Gradle eclipse plugin work well enough to resolve
dependencies and compile the java file?
Again - Thrilled,
~Lincoln
On Mon, Aug 19, 2013 at 8:29 PM, Adam Wyłuda <adamwyl92(a)gmail.com> wrote:
> Hi,
>
> I'd like to present you first screenshot of working project creation with
> Gradle addon.
>
> As you could see there are three text editors showing important aspects of
> this experiment:
> - build.gradle - created by Gradle facets, also updated by JPA - Setup
> Forge command (which added managed dependency, but Eclipse log shows it
> couldn't resolve something)
> - MyEntity.java - class generated using JPA - New entity option
> - pom.xml - I don't know how it got here, but I'm sure it is not used, as
> Eclipse log shows that Gradle is being run to obtain info about project
> (and very interesting thing - performance is much better than in Arquillian
> tests, for each Gradle run it seems to take only about 0.3 seconds)
>
> Project build file was entirely created and modified using only Gradle
> facets (if you don't believe you can pull latest version and check it
> yourself :)).
>
> Screenshot:
> [image: Obraz w treści 1]
>
--
Lincoln Baxter, III
http://ocpsoft.org
"Simpler is better."
11 years, 4 months
Fwd: Gradle Addon status update - Gradle project creation working :)
by George Gastaldi
FYI
Início da mensagem encaminhada
> De: Adam Wyłuda <adamwyl92(a)gmail.com>
> Data: 19 de agosto de 2013 21:29:04 BRT
> Para: "Lincoln Baxter, III" <lincolnbaxter(a)gmail.com>, George Gastaldi <ggastald(a)redhat.com>
> Assunto: Gradle Addon status update - Gradle project creation working :)
>
> Hi,
>
> I'd like to present you first screenshot of working project creation with Gradle addon.
>
> As you could see there are three text editors showing important aspects of this experiment:
> - build.gradle - created by Gradle facets, also updated by JPA - Setup Forge command (which added managed dependency, but Eclipse log shows it couldn't resolve something)
> - MyEntity.java - class generated using JPA - New entity option
> - pom.xml - I don't know how it got here, but I'm sure it is not used, as Eclipse log shows that Gradle is being run to obtain info about project (and very interesting thing - performance is much better than in Arquillian tests, for each Gradle run it seems to take only about 0.3 seconds)
>
> Project build file was entirely created and modified using only Gradle facets (if you don't believe you can pull latest version and check it yourself :)).
>
> Screenshot:
11 years, 4 months
ShowTerm
by George Gastaldi
http://showterm.io/
I think we could use that in our website to demo some Forge features.
Thoughts ?
--
George Gastaldi | Senior Software Engineer
JBoss Forge Team
Red Hat
11 years, 4 months