Skip to content

Commit 874d49f

Browse files
author
Paris Apostolopoulos
committed
no message
0 parents  commit 874d49f

File tree

20 files changed

+890
-0
lines changed

20 files changed

+890
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# README #
2+
3+
#README
4+
5+
This is a demo project, illustrating the use of Maven, JavaEE7 and other related technologies (WildFly 8.1, Arquillian, JPA2, ShrinkWrap), through a series of steps and evolution. The code is part of a series of posts in my blog javapapo.blogspot.com. Feel free to get the code and start experiment with it, beware this is just a demo, do not use this code in production :).
6+
7+
* Post 1: http://javapapo.blogspot.gr/2014/04/java-ee7-and-maven-project-for-newbies.html
8+
* Post 2: http://javapapo.blogspot.gr/2014/05/java-ee7-and-maven-project-for-newbies_1.html
9+
* Post 3: http://javapapo.blogspot.gr/2014/05/java-ee7-and-maven-project-for-newbies.html
10+
* Post 4: http://javapapo.blogspot.gr/2014/05/java-ee7-and-maven-project-for-newbies_30.html
11+
* Post 5: http://javapapo.blogspot.gr/2014/06/java-ee7-and-maven-project-for-newbies.html
12+
* Post 6: http://javapapo.blogspot.gr/2014/06/java-ee7-and-maven-project-for-newbies_23.html
13+
* Post 7: http://javapapo.blogspot.gr/2014/07/java-ee7-and-maven-project-for-newbies.html
14+
* Post 8: http://javapapo.blogspot.gr/2015/03/java-ee7-and-maven-project-for-newbies.html

sample-parent/pom.xml

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>gr.javapapo</groupId>
5+
<artifactId>sample-parent</artifactId>
6+
<version>0.0.1-SNAPSHOT</version>
7+
<packaging>pom</packaging>
8+
9+
<modules>
10+
<module>sample-ear</module>
11+
<module>sample-web</module>
12+
<module>sample-services</module>
13+
<module>sample-domain</module>
14+
</modules>
15+
16+
<properties>
17+
<!-- encoding-->
18+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
19+
<!--java version -->
20+
<java-version>1.7</java-version>
21+
22+
<!-- plugin versions -->
23+
<ejb-plugin-version>2.5</ejb-plugin-version>
24+
<war-plugin-version>2.6</war-plugin-version>
25+
<ear-plugin-version>2.10</ear-plugin-version>
26+
<compiler-plugin-version>3.2</compiler-plugin-version>
27+
<surefire-plugin-version>2.18.1</surefire-plugin-version>
28+
<wildfly-maven-plugin-version>1.0.2.Final</wildfly-maven-plugin-version>
29+
<maven-dependency-plugin-version>2.8</maven-dependency-plugin-version>
30+
31+
<!--path to download wildfly-->
32+
<wildfly-server-home>${project.basedir}/servers/</wildfly-server-home>
33+
34+
35+
<!-- dependency versions -->
36+
<javaee-api-version>7.0</javaee-api-version>
37+
<wildfly-version>8.2.0.Final</wildfly-version>
38+
<primefaces-version>5.1</primefaces-version>
39+
40+
<!-- EJB spec version -->
41+
<ejb-spec-version>3.2</ejb-spec-version>
42+
43+
<junit-version>4.11</junit-version>
44+
<arquillian-version>1.1.7.Final</arquillian-version>
45+
<arquillian-wildfly-version>8.2.0.Final</arquillian-wildfly-version>
46+
<arquillian-transaction-version>1.0.1.Final</arquillian-transaction-version>
47+
<shrinkwrap.bom-version>2.1.1</shrinkwrap.bom-version>
48+
49+
<!-- jbdc drivers -->
50+
<postgreslq.version>9.1-901-1.jdbc4</postgreslq.version>
51+
52+
</properties>
53+
54+
55+
<dependencyManagement>
56+
<dependencies>
57+
<dependency>
58+
<groupId>javax</groupId>
59+
<artifactId>javaee-api</artifactId>
60+
<version>${javaee-api-version}</version>
61+
</dependency>
62+
<!-- -JUNIT-->
63+
<dependency>
64+
<groupId>junit</groupId>
65+
<artifactId>junit</artifactId>
66+
<version>${junit-version}</version>
67+
</dependency>
68+
<dependency>
69+
<groupId>org.jboss.shrinkwrap.resolver</groupId>
70+
<artifactId>shrinkwrap-resolver-bom</artifactId>
71+
<version>${shrinkwrap.bom-version}</version>
72+
<type>pom</type>
73+
<scope>import</scope>
74+
</dependency>
75+
76+
<dependency>
77+
<groupId>org.jboss.shrinkwrap.resolver</groupId>
78+
<artifactId>shrinkwrap-resolver-depchain</artifactId>
79+
<version>${shrinkwrap.bom-version}</version>
80+
<type>pom</type>
81+
</dependency>
82+
83+
84+
<!-- arquillian itself-->
85+
<dependency>
86+
<groupId>org.jboss.arquillian</groupId>
87+
<artifactId>arquillian-bom</artifactId>
88+
<version>${arquillian-version}</version>
89+
<scope>import</scope>
90+
<type>pom</type>
91+
</dependency>
92+
<!-- this is in an extention to arquillian it is optional-->
93+
<dependency>
94+
<groupId>org.jboss.arquillian.extension</groupId>
95+
<artifactId>arquillian-transaction-bom</artifactId>
96+
<version>${arquillian-transaction-version}</version>
97+
<type>pom</type>
98+
<scope>import</scope>
99+
</dependency>
100+
<!-- this is container adapter for wildfly-->
101+
<dependency>
102+
<groupId>org.wildfly</groupId>
103+
<artifactId>wildfly-arquillian-container-embedded</artifactId>
104+
<version>${arquillian-wildfly-version}</version>
105+
</dependency>
106+
<!-- this is the wildfly emb.container - BUT eventually it is not a fully blown emb.container-->
107+
<dependency>
108+
<groupId>org.wildfly</groupId>
109+
<artifactId>wildfly-embedded</artifactId>
110+
<version>${arquillian-wildfly-version}</version>
111+
</dependency>
112+
113+
<dependency>
114+
<groupId>org.primefaces</groupId>
115+
<artifactId>primefaces</artifactId>
116+
<version>${primefaces-version}</version>
117+
</dependency>
118+
119+
<dependency>
120+
<groupId>postgresql</groupId>
121+
<artifactId>postgresql</artifactId>
122+
<version>${postgreslq.version}</version>
123+
</dependency>
124+
<dependency>
125+
<groupId>org.slf4j</groupId>
126+
<artifactId>slf4j-api</artifactId>
127+
<version>1.7.2</version>
128+
</dependency>
129+
</dependencies>
130+
</dependencyManagement>
131+
132+
<build>
133+
<pluginManagement>
134+
<plugins>
135+
<!-- compiler plugin -->
136+
<plugin>
137+
<groupId>org.apache.maven.plugins</groupId>
138+
<artifactId>maven-compiler-plugin</artifactId>
139+
<version>${compiler-plugin-version}</version>
140+
<configuration>
141+
<source>${java-version}</source>
142+
<target>${java-version}</target>
143+
<encoding>${project.build.sourceEncoding}</encoding>
144+
</configuration>
145+
</plugin>
146+
147+
<!-- maven ear plugin -->
148+
<plugin>
149+
<groupId>org.apache.maven.plugins</groupId>
150+
<artifactId>maven-ear-plugin</artifactId>
151+
<version>${ear-plugin-version}</version>
152+
<configuration>
153+
<generateModuleId>true</generateModuleId>
154+
<archive>
155+
<manifest>
156+
<addClasspath>true</addClasspath>
157+
<classpathPrefix>lib/</classpathPrefix>
158+
</manifest>
159+
</archive>
160+
</configuration>
161+
</plugin>
162+
<!-- ejb plugin -->
163+
<plugin>
164+
<groupId>org.apache.maven.plugins</groupId>
165+
<artifactId>maven-ejb-plugin</artifactId>
166+
<version>${ejb-plugin-version}</version>
167+
<configuration>
168+
<ejbVersion>${ejb-spec-version}</ejbVersion>
169+
</configuration>
170+
</plugin>
171+
<!-- war plugin -skinny wars mode! -->
172+
<plugin>
173+
<groupId>org.apache.maven.plugins</groupId>
174+
<artifactId>maven-war-plugin</artifactId>
175+
<version>${war-plugin-version}</version>
176+
<configuration>
177+
<failOnMissingWebXml>false</failOnMissingWebXml>
178+
<webResources>
179+
<resource>
180+
<filtering>true</filtering>
181+
<directory>src/main/webapp</directory>
182+
<includes>
183+
<include>**/web.xml</include>
184+
</includes>
185+
</resource>
186+
</webResources>
187+
</configuration>
188+
</plugin>
189+
<plugin>
190+
<groupId>org.wildfly.plugins</groupId>
191+
<artifactId>wildfly-maven-plugin</artifactId>
192+
<version>${wildfly-maven-plugin-version}</version>
193+
</plugin>
194+
<!-- Surefire Plugin -->
195+
<plugin>
196+
<groupId>org.apache.maven.plugins</groupId>
197+
<artifactId>maven-surefire-plugin</artifactId>
198+
<version>${surefire-plugin-version}</version>
199+
</plugin>
200+
<!-- Maven Dependency Plugin -->
201+
<plugin>
202+
<groupId>org.apache.maven.plugins</groupId>
203+
<artifactId>maven-dependency-plugin</artifactId>
204+
<version>${maven-dependency-plugin-version}</version>
205+
</plugin>
206+
</plugins>
207+
</pluginManagement>
208+
</build>
209+
</project>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
<parent>
4+
<groupId>gr.javapapo</groupId>
5+
<artifactId>sample-parent</artifactId>
6+
<version>0.0.1-SNAPSHOT</version>
7+
</parent>
8+
<artifactId>sample-domain</artifactId>
9+
<packaging>ejb</packaging>
10+
<name>sample-domain</name>
11+
<description>JPA entities for our project - domain model</description>
12+
<build>
13+
<finalName>${project.artifactId}</finalName>
14+
</build>
15+
<dependencies>
16+
<dependency>
17+
<groupId>javax</groupId>
18+
<artifactId>javaee-api</artifactId>
19+
<scope>provided</scope>
20+
</dependency>
21+
</dependencies>
22+
</project>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Disclaimer: this code is only for demo no production use
3+
*/
4+
package gr.javapapo;
5+
6+
import javax.persistence.Column;
7+
import javax.persistence.Entity;
8+
import javax.persistence.GeneratedValue;
9+
import javax.persistence.GenerationType;
10+
import javax.persistence.Id;
11+
12+
@Entity
13+
public class SimpleUser {
14+
15+
@Id
16+
@GeneratedValue(strategy = GenerationType.IDENTITY)
17+
private Long id;
18+
19+
@Column(unique = true)
20+
private String username;
21+
22+
public String getUsername() {
23+
return username;
24+
}
25+
26+
public void setUsername(String username) {
27+
this.username = username;
28+
}
29+
30+
public Long getId() {
31+
return id;
32+
}
33+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<persistence
2+
version="2.1"
3+
xmlns="http://xmlns.jcp.org/xml/ns/persistence"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
6+
<persistence-unit name="sample-persistence-unit" transaction-type="JTA">
7+
<properties>
8+
<!-- <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
9+
<property name="javax.persistence.schema-generation.create-source" value="script"/>
10+
<property name="javax.persistence.schema-generation.drop-source" value="script"/>
11+
<property name="javax.persistence.schema-generation.create-script-source" value="META-INF/create.sql"/>
12+
<property name="javax.persistence.schema-generation.drop-script-source" value="META-INF/drop.sql"/>
13+
<property name="javax.persistence.sql-load-script-source" value="META-INF/load.sql"/> -->
14+
</properties>
15+
</persistence-unit>
16+
</persistence>

sample-parent/sample-ear/pom.xml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>sample-parent</artifactId>
7+
<groupId>gr.javapapo</groupId>
8+
<version>0.0.1-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
<artifactId>sample-ear</artifactId>
12+
<packaging>ear</packaging>
13+
14+
<build>
15+
<finalName>sampleapp</finalName>
16+
<plugins>
17+
<!--Ear plugin -creating the ear - watch out skinny WARS!-->
18+
<plugin>
19+
<groupId>org.apache.maven.plugins</groupId>
20+
<artifactId>maven-ear-plugin</artifactId>
21+
<configuration>
22+
<finalName>sampleapp</finalName>
23+
<defaultJavaBundleDir>lib/</defaultJavaBundleDir>
24+
<skinnyWars>true</skinnyWars>
25+
<modules>
26+
<webModule>
27+
<groupId>gr.javapapo</groupId>
28+
<artifactId>sample-web</artifactId>
29+
</webModule>
30+
<ejbModule>
31+
<groupId>gr.javapapo</groupId>
32+
<artifactId>sample-services</artifactId>
33+
</ejbModule>
34+
</modules>
35+
</configuration>
36+
</plugin>
37+
<plugin>
38+
<groupId>org.wildfly.plugins</groupId>
39+
<artifactId>wildfly-maven-plugin</artifactId>
40+
<configuration>
41+
<jboss-home>${wildfly-server-home}/wildfly-${wildfly-version}</jboss-home>
42+
<ignoreMissingDeployment>true</ignoreMissingDeployment>
43+
</configuration>
44+
<executions>
45+
<execution>
46+
<id>DEPLOY TO WILDFLY</id>
47+
<phase>install</phase>
48+
<goals>
49+
<goal>undeploy</goal>
50+
<goal>deploy</goal>
51+
</goals>
52+
</execution>
53+
</executions>
54+
</plugin>
55+
</plugins>
56+
57+
</build>
58+
<!-- our in app dependencies-->
59+
<dependencies>
60+
61+
<dependency>
62+
<groupId>gr.javapapo</groupId>
63+
<artifactId>sample-web</artifactId>
64+
<version>${project.version}</version>
65+
<type>war</type>
66+
</dependency>
67+
68+
<dependency>
69+
<groupId>gr.javapapo</groupId>
70+
<artifactId>sample-services</artifactId>
71+
<version>${project.version}</version>
72+
<type>ejb</type>
73+
</dependency>
74+
75+
76+
</dependencies>
77+
</project>

0 commit comments

Comments
 (0)