Skip to content

Commit

Permalink
Jakarta is default (primefaces#413)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Aug 21, 2024
1 parent 7f67c10 commit 82e7993
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 214 deletions.
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,14 @@ This is a sample maven project that uses <strong>Latest PrimeFaces Release</stro

You can execute the sample with <strong>mvn jetty:run</strong> command and hit <strong>http://localhost:8080/</strong> to run the page.

### JSF Versions
### Jakarta EE10 Version
***

Per default the application uses Mojarra 2.3.x.
You can also use other versions with the available maven profiles: myfaces23, myfaces23next, mojarra23

`mvn clean jetty:run -Pmyfaces23`
PrimeFaces Test is setup to run again Jakarta EE10 profile using Jetty 12. You can also use other versions with the available maven profiles: mojarra40, myfaces40

`mvn clean jetty:run -Pmyfaces23next`
`mvn clean jetty:run -Pmojarra40`

`mvn clean jetty:run -Pmojarra23`
`mvn clean jetty:run -Pmyfaces40`

### Server Port
***
Expand All @@ -25,19 +22,23 @@ By default the application runs on port 8080 but if you would like to use a diff

`mvn clean jetty:run -Djetty.port=5000`

### Jakarta EE10 Version

### JPA Lazy Datatable
***

The branch `jakarta` contains a PrimeFaces Test setup to run again Jakarta EE10 profile using Jetty 11. You can also use other versions with the available maven profiles: mojarra40, myfaces40
The branch `jpa` contains a PrimeFaces Test setup to run with JPA using the JPA LazyDatatable advanced example.

`mvn clean jetty:run -Pmojarra40`
### Legacy JSF Versions
***

`mvn clean jetty:run -Pmyfaces40`
The branch `javax` contains a PrimeFaces Test setup to run again Jakarta EE10 profile using Jetty 9. Per default the application uses Mojarra 2.3.x.
You can also use other versions with the available maven profiles: myfaces23, myfaces23next, mojarra23

### JPA Lazy Datatable
***
`mvn clean jetty:run -Pmyfaces23`

The branch `jpa` contains a PrimeFaces Test setup to run with JPA using the JPA LazyDatatable advanced example.
`mvn clean jetty:run -Pmyfaces23next`

`mvn clean jetty:run -Pmojarra23`

### Visual Studio Code Quickstart
***
Expand Down
162 changes: 36 additions & 126 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<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">
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.primefaces</groupId>
<artifactId>primefaces-test</artifactId>
Expand All @@ -10,80 +11,33 @@
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<maven.compiler.release>11</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<owb.version>2.0.27</owb.version>
<jetty.version>9.4.55.v20240627</jetty.version>
<jetty.version>12.0.12</jetty.version>
<jetty.port>8080</jetty.port>
</properties>
<dependencies>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>14.0.4</version>
<classifier>jakarta</classifier>
</dependency>
<!-- javax.* APIs -->
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-atinject_1.0_spec</artifactId>
<version>1.2</version>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet-core</artifactId>
<version>5.1.2.Final</version>
<exclusions>
<exclusion>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jcdi_2.0_spec</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-interceptor_1.2_spec</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-annotation_1.3_spec</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-validation_2.0_spec</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.6</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>
<!-- OpenWebBeans -->
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-impl</artifactId>
<version>${owb.version}</version>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-jsf</artifactId>
<version>${owb.version}</version>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-web</artifactId>
<version>${owb.version}</version>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-el22</artifactId>
<version>${owb.version}</version>
</dependency>
<dependency>
<groupId>org.apache.bval</groupId>
<artifactId>bval-jsr</artifactId>
Expand All @@ -93,7 +47,6 @@
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.34</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
Expand Down Expand Up @@ -138,50 +91,37 @@
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<groupId>org.eclipse.jetty.ee10</groupId>
<artifactId>jetty-ee10-maven-plugin</artifactId>
<version>${jetty.version}</version>
<configuration>
<webAppConfig>
<!-- see https://eclipse.dev/jetty/documentation/jetty-12/programming-guide/index.html#jetty-run-goal -->
<webApp>
<contextPath>/</contextPath>
<jettyEnvXml>${project.basedir}/src/main/conf/jetty-env.xml</jettyEnvXml>
</webAppConfig>
<scanIntervalSeconds>5</scanIntervalSeconds>
</webApp>
<scan>5</scan>
<webXml>${project.build.directory}/web.xml</webXml>
<httpConnector>
<host>0.0.0.0</host>
<port>${jetty.port}</port>
<idleTimeout>60000</idleTimeout>
</httpConnector>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.2.5</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.ee10</groupId>
<artifactId>jetty-ee10-cdi</artifactId>
<version>${jetty.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<directory>${basedir}/src/main/resources</directory>
</resource>
<resource>
<directory>${project.basedir}/src/main/webapp/WEB-INF</directory>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<includes>
<include>web.xml</include>
</includes>
Expand All @@ -192,62 +132,32 @@
</build>
<profiles>
<profile>
<id>myfaces23</id>
<dependencies>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>2.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>2.3.10</version>
</dependency>
</dependencies>
<build>
<filters>
<filter>${project.basedir}/src/main/conf/myfaces.properties</filter>
</filters>
</build>
</profile>
<profile>
<id>myfaces23next</id>
<id>myfaces40</id>
<dependencies>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>2.3-next-M8</version>
<version>4.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>2.3-next-M8</version>
<version>4.0.2</version>
</dependency>
</dependencies>
<build>
<filters>
<filter>${project.basedir}/src/main/conf/myfaces.properties</filter>
</filters>
</build>
</profile>
<profile>
<id>mojarra23</id>
<id>mojarra40</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.faces</artifactId>
<version>2.3.21</version>
<version>4.0.7</version>
</dependency>
</dependencies>
<build>
<filters>
<filter>${project.basedir}/src/main/conf/mojarra.properties</filter>
</filters>
</build>
</profile>
</profiles>
</project>
17 changes: 0 additions & 17 deletions src/main/conf/jetty-env.xml

This file was deleted.

1 change: 0 additions & 1 deletion src/main/conf/mojarra.properties

This file was deleted.

1 change: 0 additions & 1 deletion src/main/conf/myfaces.properties

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.primefaces.test;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.faces.annotation.FacesConfig;

@FacesConfig
@ApplicationScoped
public class PrimeFacesTestApplicationConfig {

}
12 changes: 6 additions & 6 deletions src/main/java/org/primefaces/test/TestView.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@
import java.io.Serializable;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import jakarta.annotation.PostConstruct;
import jakarta.faces.view.ViewScoped;
import jakarta.inject.Named;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.view.ViewScoped;
import javax.inject.Named;

import lombok.Data;

@Data
@Named
@ViewScoped
public class TestView implements Serializable {

private String string;
private Integer integer;
private BigDecimal decimal;
private LocalDateTime localDateTime;
private List<TestObject> list;
@PostConstruct

@PostConstruct
public void init() {
string = "Welcome to PrimeFaces!!!";
list = new ArrayList<>(Arrays.asList(
Expand Down
9 changes: 4 additions & 5 deletions src/main/webapp/WEB-INF/beans.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</beans>
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd" bean-discovery-mode="all" version="4.0">
</beans>
9 changes: 5 additions & 4 deletions src/main/webapp/WEB-INF/faces-config.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<faces-config
xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd"
version="4.0">
<application>
<action-listener>org.primefaces.application.DialogActionListener</action-listener>
<navigation-handler>org.primefaces.application.DialogNavigationHandler</navigation-handler>
Expand Down
Loading

0 comments on commit 82e7993

Please sign in to comment.