This tutorial will see a new JEE template project created and pushed to GitHub, a great foundation for all my future projects.
Create the new project
First create a new Java project using maven based on the maven archetype quickstart, this quickstart gives you a blank maven style project structure, you’ll want to update the groupId and artifactId appropriately.
Here’s what I use to create a new template project:
mvn archetype:generate -DgroupId=com.csw -DartifactId=jee7-template -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
This creates a new root project folder named jee7-template with this structure
csw@latitude:/tmp/jee7-template$ tree- pom.xml
src
|- main
|- java
|- com
|- csw
|- App.java
|- test
|- java
|- com
|- csw
|- AppTest.java9 directories, 3 files
Great, next open up the pom.xml and add the javaee api dependency under the dependencies section
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
The javaee-api dependency pulls in all the JEE 7 APIs (EJB, JTA, JCA, CDI and more) ready for your application to use. Notice the dependency scope is set to provided, this means it won’t end up bundled in your WAR file.
Push to GitHub
Pushing the project up to GitHub is simple, first login to your GitHub account and create a new project (plus sign top right)

Populate the repository name, in this case I’m using the repo name jee7-template and I’ll keeping this project publicly accessible.

There is no need to check any of the 3 checkboxes “Add a README file”, “Add .gitignore” or “Choose a license”. Finish by clicking the Create repository button!
So far we have a skeleton JEE7 project on our local development machine and a new blank repository. All we need to do now is push an existing repository from the command like like this
Before we’re able to push the new template project we need to create a new access token. As of August 13th 2021 GitHub removed authenticate via username and password in favour of access tokens. How to create a new access token.
When you have your access token configured you’re good to push this newly created template project up to GitHub
%> git init
%> git add .
%> git commit -m "start"
%> git branch -M main
%> git remote add origin https://devtoken:<your_token>@github.com/webweaves/jee7-template.git
%> git push --set-upstream origin mainCounting objects: 15, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (15/15), 1.43 KiB | 1.43 MiB/s, done.
Total 15 (delta 0), reused 0 (delta 0)
To https://github.com/webweaves/jee7-template.git
* [new branch] main -> main
Branch 'main' set up to track remote branch 'main' from 'origin'.
That’s all there is to it, you now have a new JEE7 project that’s pushed up to GitHub! Checkout the result here https://github.com/webweaves/jee7-template
References:
Maven archetype quickstart https://maven.apache.org/archetypes/maven-archetype-quickstart/