Skip to content

AlfonsoG-dev/JavaBuildConfig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java build

  • A java build tool that uses a configuration file to build the project.

Its made for simple java project with minimal use of .jar dependencies.

  • Build the entire project. expected output

  • Compile some other source. expected_recompile


Installation

This is a step by step guide on how to install this tool.

  1. Download the source code of the project from build tool.
  2. Build the project to get a .jar file to use.

You can use the .ps1 build script.

pwsh build.ps1
  1. Execute the jar file with the Java cli tools.
java -jar App.jar

Configuration

Use a config.txt file to store the project configuration.

The following its an example of the configuration on this particular project.

Root-Path: src
Source-Path: src\application
Class-Path: bin
Main-Class: application.JavaBuildConfig
Test-Path: src\test
Test-Class: test.TestLauncher
Libraries: include/exclude/ignore
Compile--flags: -Werror

You can create the config.txt file with:

java -jar javaBuild.jar --config
  • Once created you can change the values manually.

Usage

In this build tool you have the following commands:

  1. Compile command:
  • Use --compile to compile the project.
java -jar javaBuild.jar --compile

You can use 3 sub-commands:

  • --s sourcePath to change the source path.
  • --t classPath to change the target path.
  • --i to include or not the lib files.
  • --f to insert flags to the compile process.
  1. Run Command
  • Use --run to execute the project.
java -jar javaBuild.jar --run

You can use 4 sub-commands:

  • src\app.java to change the main class to execute.
  • --s to change the source path.
  • --t to change the target path.
  • --i to include or not the lib files.
  • --f to insert flags to the run process.
  1. Create jar file
  • Use --jar to create the build .jar file of the application.
java -jar javaBuild.jar --jar
  • fileName to change the .jar file name.
java -jar javaBuild.jar --jar app

Now the .jar file will be name app.jar

  • --s to change the source path.
  • --t to change the target path.
  • -e to change the entry point if manifesto isn't present.
  • --f to insert flags to the run process.
  1. Build project
  • It compile and creates the .jar file of the project.

Just to save time you only enter this command insted of two.

java -jar javaBuild.jar --build

It accepts the same command as compile but the --f only works for compile not for --jar command.

java -jar javaBuild.jar --build --f -g

The previous command will add -g flag to the compile process enabling debug information.

  1. Configuration
  • It created or modifies the configuration and manifesto file
java -jar javaBuild.jar --config

You can change the source by giving --s src You can change the target by giving --t bin You can change the main class by giving its name

  • You can also change the author of the project with -a Owner-Mine
java -jar javaBuild.jar --config src.App -a Owner-Mine

You can "include/exclude" lib dependencies by giving --i include/exclude


Disclaimer

  • This project is for educational purposes.
  • Security issues are not taken into account.
  • Use it at your own risks.

About

A playground to improve and test some stuff about the build process for Java applications

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published