Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nishkarshraj/maven-using-cmd
Create a project in Java using Apache Maven Build tool via Command Line and use GitHub Actions to build it on remote Docker Engine.
https://github.com/nishkarshraj/maven-using-cmd
apache build-automation cmd command-line command-line-tool css dependabot devops html java maven maven-repository
Last synced: about 2 months ago
JSON representation
Create a project in Java using Apache Maven Build tool via Command Line and use GitHub Actions to build it on remote Docker Engine.
- Host: GitHub
- URL: https://github.com/nishkarshraj/maven-using-cmd
- Owner: NishkarshRaj
- License: mit
- Created: 2019-06-30T06:28:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-12-16T06:18:34.000Z (about 1 year ago)
- Last Synced: 2024-05-02T04:20:07.489Z (8 months ago)
- Topics: apache, build-automation, cmd, command-line, command-line-tool, css, dependabot, devops, html, java, maven, maven-repository
- Language: Java
- Homepage: https://iq.opengenus.org/building-java-application-using-apache-maven-command-line/
- Size: 639 KB
- Stars: 15
- Watchers: 4
- Forks: 30
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Apache Maven (Command Line)
# Creating a Simple Java Project name: mvn-cmd :smile:## Step 1: Create the java project
```
Syntax: mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=falseExplanation: For beginners,
Only two things are of concern:
1) Group ID: This will be our package name.
2) Artifact ID: This is our project name (mvn-cmd)
```
![Image](img/Create%20Project.png)## Step 2: Check the Directory Structure of created project
```
At the source folder of the project:
1) src/
It contains two folders:
1.1) main/
It is used to create codes in java
1.2) test/
It is used to create JUnit Test cases
2) pom.xml
Pom.xml is the mail build file of the maven!
```
![Image](img/Maven%20Directory%20Structure.png)## Step 3: Change the source code (and file name) as you want to make
```
Go to /src/main/java/pkg1
NOTE: pkg1 is the package name we defined while creating the project.
Always include package name in the code.
Modify the app.java file
Rename to the file name you want.
```
![Image](img/Source%20Directory%20for%20coding.png)## Step 4: Clean the project area
## Syntax: mvn clean
```
Before start building a project, it is necessary to delete old configuration files.
mvn clean command is used to delete the target/ folder.
```
![Image](img/mvn%20clean.png)## Step 5: Compile the Project source code
## Syntax: mvn compile
```
This command is used to check whether the source code we wrote in java file is correct syntactically or not.
```
![Image](img/mvn%20compile.png)## Step 6: Unit Testing
## Syntax: mvn test
```
This work is tricky.
You must know how to create JUnit Test cases.
You need to define the Unit Test cases in /src/test/pkg1
```
![Image](img/mvn%20test.png)## Step 7: Install (Build the Project)
```
Checks the Maven Configuration in pom.xml file
Creates the project build.
Creates jar file in target/ folder which can be deployed
```
![Image](img/mvn%20install.png)## Step 8: Site
## Syntax: mvn site
```
Maven Site command is used to create GUI reports
It creates reports in format of web pages in HTML+CSS format.
Site Reports are stored in /target/site
```
![Image](img/mvn%20site.png)## Here is one Web Page of Site Report
![Image](img/mvn%20site%20results.png)
## How To Contribute
[Contribution Guidelines](CONTRIBUTING.md)
## Contributors
1. @NishkarshRaj
2. @navyakanu [Special Thanks for setting up GitHub Actions]
3. @acodebreaker
4. @RiyaJohn
5. @tuhinchakraborty
## License
[MIT Licence](LICENSE)