- 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 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.
pwsh java-exe.ps1
- it will build the project and create the jar file to use for the .exe file creation.
- 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
javabuild --h
- use the jar file
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
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.
- 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.
- you can give a folder path to indicate the directory where you want to place the compiled files.
javabuild -cm .\otro\target
- to create a jar file is necessary to include or verify dependencies or libraries in the project.
- 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 -cj
.- it also can be created using source folder as parameter:
javabuild -cj .\testing\
- to create the manifesto file, is necessary to include or verify if you want to add to the build the extraction of the dependencies or not.
- in order to create the jar file you can include the extraction files of a dependency:
javabuild --i
- in order to create the jar file and exclude the extraction files of a dependency:
javabuild --i n
- all can be done with only 1 command
javaBuild --build
- 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
- creates the project structure
javaBuild -b author-name
- adds the manifesto file and the main class with the project folder name
javabuild --run
- 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
- additional you can execute CLI command with this method too
javabuild --run --h
javaBuild -r
- creates the powershell script whit all the command to build the project, except the extraction operation
- executes the project
- add an external dependency
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
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 a
.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
- only works when the lib file don't contain modules