This is a template for a Java project using the Makefile build system.
main
├── java
│ └── com
│ └── cwru
│ └── pokeverse
│ ├── App.java
│ ├── dao
│ │ ├── abstraction
│ │ │ ├── CRUD.java
│ │ │ └── PokemonDAO.java
│ │ └── implementation
│ │ └── PokemonImp.java
│ ├── models
│ │ └── Pokemon.java
│ └── utils
│ ├── DatabaseConnection.java
│ └── InitDatabase.java
└── resources
└── db.properties
The build process can be done either by using Makefile or Maven. To use Makefile follow the instructions below, otherwise skip to the Maven section.
make source
This target finds all Java source files in the $(SRC)
directory and saves their paths to a file named sources.txt
.
make compile
This target compiles the Java source files using $(JC) (the Java compiler)
and saves the compiled class files to the $(DIST)
directory. It also includes the classpath of the $(DIST)
directory and all JAR files in the $(LIB)
directory.
make run
This target runs the main class of the project using $(JAVA) (the Java runtime)
and the classpath of the $(DIST)
directory and all JAR files in the $(LIB)
directory.
make build
This target creates a JAR
file named App.jar containing the compiled class files and all files in the $(LIB)
directory, using $(JAR) (the Java archiver)
.
make exec
This target runs the main class of the project using the JAR
file created by the build target, as well as the classpath of the$(DIST)
directory and all JAR files in the $(LIB)
directory.
mvn compile
make docker-up
This target builds the Docker image and runs the PostgreSQL and pgAdmin containers.
make docker-down
This target stops and removes the PostgreSQL and pgAdmin containers.