- basic build tool for simple java projects
- build the project with 1 or 3 simple commands
- It works on WINDOWS & LINUX
- compile the project to bin.
- extracts the jar files inside lib to create later the project jar file.
- create the project jar file.
- run the project without using jar files.
- build the project, combine the 3 previously mention.
- create the folder structure of the project.
- create the run powershell script and executes the project.
- add cli option to the create build script to allow the user to name the script.
- add to the --add CLI command the aggregation of modules like the ones of JavaFX
- implement the module aggregation for compile, run, create-jar, execution script
- use the
.ps1
script to build the project.
build.ps1
or
./build.sh
- it will build the project and create the jar file to use for the .exe file creation.
- now you have the jar file to test the project functionality.
- use the executable
- This will print the cli commands that you can used.
javabuild --h
- use the jar file to execute the program for the same purpose.
java -jar JavaBuild.jar --h
- when the app have dependencies in lib folder you need to specify in the Manifesto file if you want to include the extraction files of the lib dependency or you need to declara in the Manifesto the class path of the lib dependencies
Created-By: Author-Name
Main-Class: App
Class-Path: .\lib\dependencyFolder\dependency.jar
- when you declare the Class-Path the build operation when trying to create the project .jar file, it exclude the extraction files of the lib dependency.
- if you don't declare the Class-Path the build operation when trying to create the project .jar file, now includes the extraction files of the lib dependency as part of the project .jar creation.
- Use this to list the java class files inside the given folder.
javaBuild -ls .\src\
- Use this to create the structure for the project.
- You need to provide the author
javaBuild -cb Author-Name
- As soon you create the project you need to change the manifesto adding the main class.
javaBuild --i
- This will add the main class value to the manifesto.
- to compile the project.
javaBuild -cm
.
- it compiles the .java clases into bin.
- you can give a folder path to indicate the directory where you want to place the compiled files.
- The default folder for the class files is *.\bin*
javabuild -cm .\other\target
- to create a jar file is necessary to include or verify dependencies or libraries in the project.
- in order to create the jar file we need to extract the content of all the jar files inside lib into:
extractionFiles
.- use the extracted files to include the library files in the build process of the project .jar file.
javaBuild -ex
.
- now to create the project jar file.
javaBuild -cx
.- it also can be created using source folder as parameter:
javabuild -cx .\testing\
- remember that the manifesto determines the behavior for the build process.
- Use this to create the build script for powershell in windows and bash for linux.
- Creates the script whit all the command to build the project, except the extraction operation.
- And at last it executes the project.
javaBuild -cr
- The manifesto file, is necessary to include or verify if you want to add to the build the extraction of the dependencies or not.
- To include the extraction files of a dependency:
javabuild --i
otherwisejavabuild --i n
- All can be done with only 1 command
- It combines the commands: compile & create jar to build the project.
- The extraction of the jar dependency need to execute manually with:
-ex
and only one time per jar dependency.- If you have configured the manifesto the dependency extraction will behave as describe previously.
javaBuild --build
- Also you can give the source folder of the class files.
- If not *.\bin* will be use
javaBuild --build -s .\testing\
- Uses the class files and the main class to execute and run the application.
- it compiles to *.\bin* folder and executes the project using the .class files.
- you can specify the java class that you want to execute:
javabuild --run .\src\App.java
- you can give also the source directory
javabuild --run .\src\App.java -s .\testing\
- if you don't give the class to execute the main class is selected
- additional you can execute CLI command with this method too
javabuild --run --h
- Used to add a framework or library file type .jar.
javabuild --add dependency.jar
- add an external jar file to the lib folder of the project
- or you can use the directory name
javabuild --add ./folderName
- Only works when the lib file don't contain modules.
This project use javaBuild_tool to build itself.
- this app uses powershell to execute the commands on WINDOWS.
- this app uses bash to execute commands on LINUX.
- if you want to use the CLI tool you have to create an
.exe
file and place it in system path- for LINUX
$ echo '#!/usr/bin/java -jar' > myBin
$ cat my.jar >> myBin
$ chmod +x myBin
$ ./myBin
- with that you can create an environment variable and use it from there.
- this project is for educational purposes.
- security issues are not taken into account.
- Use it at your own risk.