Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mvnw and update dependencies #321

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ jobs:
restore-keys: ${{ runner.os }}-m2

- name: Build with Maven
run: mvn clean package --file pom.xml
run: ./mvnw clean package --file pom.xml
8 changes: 4 additions & 4 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ jobs:
restore-keys: ${{ runner.os }}-m2

- name: Build with Payara
run: mvn clean package --file pom.xml
run: ./mvnw clean package --file pom.xml

- name: Build with GlassFish
run: mvn clean package -Pglassfish --file pom.xml
run: ./mvnw clean package -Pglassfish --file pom.xml

- name: Build with Open Liberty
run: mvn clean package -Popenliberty --file pom.xml
run: ./mvnw clean package -Popenliberty --file pom.xml

- name: Build for the cloud
run: mvn clean package -Pcloud -DpostgreSqlJdbcUrl="jdbc:postgresql://postgres:5432/postgres" -DpostgreSqlUsername="${{ secrets.POSTGRES_USER }}" -DpostgreSqlPassword="${{ secrets.POSTGRES_PASSWORD }}" --file pom.xml
run: ./mvnw clean package -Pcloud -DpostgreSqlJdbcUrl="jdbc:postgresql://postgres:5432/postgres" -DpostgreSqlUsername="${{ secrets.POSTGRES_USER }}" -DpostgreSqlPassword="${{ secrets.POSTGRES_PASSWORD }}" --file pom.xml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ data
.DS_Store
cargo-tracker-test-data
nbactions.xml
.java-version
19 changes: 19 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
70 changes: 41 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# Eclipse Cargo Tracker - Applied Domain-Driven Design Blueprints for Jakarta EE

The project demonstrates how you can develop applications with Jakarta EE using widely adopted architectural best practices like Domain-Driven
Design (DDD). The project is based on the well-known [Java DDD sample application](https://github.com/citerus/dddsample-core) developed by DDD pioneer Eric Evans' company Domain Language and the Swedish
software consulting company Citerus. The cargo example actually comes from
Eric Evans' seminal book on DDD.
The project demonstrates how you can develop applications with Jakarta EE using widely adopted architectural best
practices like Domain-Driven Design (DDD). The project is based on the well-known [Java DDD sample application](https://github.com/citerus/dddsample-core)
developed by DDD pioneer Eric Evans' company Domain Language and the Swedish software consulting company Citerus.
The cargo example actually comes from Eric Evans' seminal book on DDD.

The application is an end-to-end system for keeping track of shipping cargo. It
has several interfaces described in the following sections.

For further details on the project, please visit: https://eclipse-ee4j.github.io/cargotracker/.

A slide deck introducing the
fundamentals of the project is available on the official Eclipse
A slide deck introducing the fundamentals of the project is available on the official Eclipse
Foundation [Jakarta EE SlideShare account](https://www.slideshare.net/Jakarta_EE/applied-domaindriven-design-blueprints-for-jakarta-ee). A recording of the slide deck is available on the official [Jakarta EE YouTube account](https://www.youtube.com/watch?v=pKmmZd-3mhA).

![Eclipse Cargo Tracker cover](cargo_tracker_cover.png)
Expand All @@ -25,29 +24,30 @@ The simplest steps are the following (no IDE required):
* Get the project source code.
* Ensure you are running Java SE 11 or Java SE 17.
* Make sure JAVA_HOME is set.
* As long as you have Maven set up properly, navigate to the project source root and type:
* Navigate to the project source root and type:
```
mvn clean package cargo:run
./mvnw clean package cargo:run
```
* Go to http://localhost:8080/cargo-tracker

This will run the application with Payara Server by default. The project also has Maven profiles to support GlassFish and Open Liberty. For example you can run using GlassFish using the following command:
This will run the application with Payara Server by default. The project also has Maven profiles to support GlassFish
and Open Liberty. For example, you can run using GlassFish using the following command:

```
mvn clean package -Pglassfish cargo:run
./mvnw clean package -Pglassfish cargo:run
```

Similarly you can run using Open Liberty using the following command:
Similarly, you can run using Open Liberty using the following command:

```
mvn clean package -Popenliberty liberty:run
./mvnw clean package -Popenliberty liberty:run
```

To set up in Visual Studio Code, follow these steps:

* Set up Java SE 11, or Java SE 17, [Visual Studio Code](https://code.visualstudio.com/download) and [Payara 6](https://www.payara.fish/downloads/payara-platform-community-edition/). You will also need to set up the [Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) and [Payara Tools](https://marketplace.visualstudio.com/items?itemName=Payara.payara-vscode) in Visual Studio Code.
* Make sure JAVA_HOME is set.
* Open the directory that contains the code in Visual Studio Code. Visual Studio Code will do the rest for you, it will automatically configure a Maven project. Proceed with clean/building the application.
* Open the directory that contains the code in Visual Studio Code. Visual Studio Code will do the rest for you, it should automatically configure a Maven project. Proceed with clean/building the application.
* After the project is built (which will take a while the very first time as Maven downloads dependencies), simply run the generated `cargo-tracker.war` file under the `target` directory using Payara Tools.

You can similarly use GlassFish or Open Liberty in Visual Studio Code.
Expand All @@ -62,8 +62,8 @@ There are several web interfaces, REST interfaces and a file system scanning
interface. It's probably best to start exploring the interfaces in the rough
order below.

The tracking interface let's you track the status of cargo and is
intended for the general public. Try entering a tracking ID like ABC123 (the
The tracking interface lets you track the status of cargo and is
intended for the public. Try entering a tracking ID like ABC123 (the
application is pre-populated with some sample data).

The administrative interface is intended for the shipping company that manages
Expand All @@ -76,29 +76,34 @@ also change the destination for cargo if needed or track cargo.

The Handling Event Logging interface is intended for port personnel registering what
happened to cargo. The interface is primarily intended for mobile devices, but
you can use it via a desktop browser. The interface is accessible at this URL: http://localhost:8080/cargo-tracker/event-logger/index.xhtml. For convenience, you
you can use it via a desktop browser. The interface is accessible at this URL:
http://localhost:8080/cargo-tracker/event-logger/index.xhtml. For convenience, you
could use a mobile emulator instead of an actual mobile device. Generally speaking cargo
goes through these events:

* It's received at the origin location.
* It's loaded and unloaded onto voyages on it's itinerary.
* It's claimed at it's destination location.
* It's loaded and unloaded onto voyages on its itinerary.
* It's claimed at its destination location.
* It may go through customs at arbitrary points.

While filling out the event registration form, it's best to have the itinerary
handy. You can access the itinerary for registered cargo via the admin interface. The cargo handling is done via Messaging for scalability. While using the event logger, note that only the load and unload events require as associated voyage.
While filling out the event registration form, it's best to have the itinerary handy. You can access the itinerary for
registered cargo via the admin interface. The cargo handling is done via Messaging for scalability. While using the
event logger, note that only the load and unload events require as associated voyage.

You should also explore the file system based bulk event registration interface.
It reads files under /tmp/uploads. The files are just CSV files. A sample CSV
file is available under [src/test/sample/handling_events.csv](src/test/sample/handling_events.csv). The sample is already set up to match the remaining itinerary events for cargo ABC123. Just make sure to update the times in the first column of the sample CSV file to match the itinerary as well.
file is available under [src/test/sample/handling_events.csv](src/test/sample/handling_events.csv). The sample is already set up to match the remaining
itinerary events for cargo ABC123. Just make sure to update the times in the first column of the sample CSV file to
match the itinerary as well.

Sucessfully processed entries are archived under /tmp/archive. Any failed records are
Successfully processed entries are archived under /tmp/archive. Any failed records are
archived under /tmp/failed.

Don't worry about making mistakes. The application is intended to be fairly
error tolerant. If you do come across issues, you should [report them](https://github.com/eclipse-ee4j/cargotracker/issues).

You can simply remove ./cargo-tracker-data from the file system to restart fresh. This directory will typically be under $your-payara-installation/glassfish/domains/domain1/config.
You can simply remove ./cargo-tracker-data from the file system to restart fresh. This directory will typically be
under $your-payara-installation/glassfish/domains/domain1/config.

You can also use the soapUI scripts included in the source code to explore the
REST interfaces as well as the numerous unit tests covering the code base
Expand All @@ -117,16 +122,19 @@ approach to software design and development that focuses on the core domain and
domain logic.

For the most part, it's fine if you are new to Jakarta EE. As long as you have a
basic understanding of server-side applications, the code should be good enough to get started. For learning Jakarta EE further,
we have recommended a few links in the resources section of the project site. Of
basic understanding of server-side applications, the code should be good enough to get started. For learning Jakarta EE
further, we have recommended a few links in the resources section of the project site. Of
course, the ideal user of the project is someone who has a basic working
understanding of both Jakarta EE and DDD. Though it's not our goal to become a kitchen
sink example for demonstrating the vast amount of APIs and features in Jakarta EE,
we do use a very representative set. You'll find that you'll learn a fair amount
by simply digging into the code to see how things are implemented.

## Cloud Demo
Cargo Tracker is deployed to Kubernetes on the cloud using GitHub Actions workflows. You can find the demo deployment on the Scaleforce cloud (https://cargo-tracker.j.scaleforce.net). This project is very thankful to our sponsors [Jelastic](https://jelastic.com) and [Scaleforce](https://www.scaleforce.net) for hosting the demo! The deployment and all data is refreshed nightly. On the cloud Cargo Tracker uses PostgreSQL as the database. The [GitHub Container Registry](https://ghcr.io/eclipse-ee4j/cargo-tracker) is used to publish Docker images.
Cargo Tracker is deployed to Kubernetes on the cloud using GitHub Actions workflows. You can find the demo deployment on
the Scaleforce cloud (https://cargo-tracker.j.scaleforce.net). This project is very thankful to our sponsors [Jelastic](https://jelastic.com)
and [Scaleforce](https://www.scaleforce.net) for hosting the demo! The deployment and all the data is refreshed nightly. On the cloud Cargo Tracker
uses PostgreSQL as the database. The [GitHub Container Registry](https://ghcr.io/eclipse-ee4j/cargo-tracker) is used to publish Docker images.

## Jakarta EE 8
A Jakarta EE 8, Java SE 8, Payara 5 version of Cargo Tracker is available under the ['jakartaee8' branch](https://github.com/eclipse-ee4j/cargotracker/tree/jakartaee8).
Expand All @@ -135,9 +143,13 @@ A Jakarta EE 8, Java SE 8, Payara 5 version of Cargo Tracker is available under
A Java EE 7, Java SE 8, Payara 4.1 version of Cargo Tracker is available under the ['javaee7' branch](https://github.com/eclipse-ee4j/cargotracker/tree/javaee7).

## Contributing
This project complies with the Google Style Guides for [Java](https://google.github.io/styleguide/javaguide.html), [JavaScript](https://google.github.io/styleguide/jsguide.html), and [HTML/CSS](https://google.github.io/styleguide/htmlcssguide.html). You can use the [google-java-format](https://github.com/google/google-java-format) tool to help you comply with the Google Java Style Guide. You can use the tool with most major IDEs such as Eclipse, Visual Studio Code, and IntelliJ.
This project complies with the Google Style Guides for [Java](https://google.github.io/styleguide/javaguide.html), [JavaScript](https://google.github.io/styleguide/jsguide.html), and [HTML/CSS](https://google.github.io/styleguide/htmlcssguide.html).
You can use the [google-java-format](https://github.com/google/google-java-format) tool to help you comply with the Google Java Style Guide. You can use the
tool with most major IDEs such as Eclipse, Visual Studio Code, and IntelliJ.

In general for all files we use a column/line width of 80 whenever possible and we use 2 spaces for indentation. All files must end with a new line. Please adjust the formatting settings of your IDE accordingly. You are encouraged but not required to use HTML Tidy and CSS Tidy to help format your code.
In general for all files we use a column/line width of 80 whenever possible, and we use 2 spaces for indentation.
All files must end with a new line. Please adjust the formatting settings of your IDE accordingly. You are encouraged
but not required to use HTML Tidy and CSS Tidy to help format your code.

For further guidance on contributing including the project roadmap, please look [here](CONTRIBUTING.md).

Expand All @@ -150,7 +162,7 @@ For further guidance on contributing including the project roadmap, please look
explained [here](https://github.com/payara/Payara/issues/3038).
* If you restart the application a few times, you will run into a bug causing a spurious deployment failure. While the problem can be annoying, it's harmless. Just re-run the application (make sure to completely un-deploy the application and shut down Payara first).
* Sometimes when the server is not shut down correctly or there is a locking/permissions issue, the H2 database that
the application uses get's corrupted, resulting in strange database errors. If
the application uses gets corrupted, resulting in strange database errors. If
this occurs, you will need to stop the application and clean the database. You
can do this by simply removing the cargo-tracker-data directory from the file
system and restarting the application. This directory will typically be under $your-payara-installation/glassfish/domains/domain1/config.
Expand Down
Loading