- Open your GitHub account (Register if needed)
- Create new repository "maven-test" + README
- Clone your repository to your client
git clone https://your-git-url
- Create GitHub issue and a branch to create a new maven application
- Pull your repository and initialize a maven demo application
mvn -B archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=hu.bme.mit.devops -DartifactId=maven-app
- Extend pom.xml with the following part
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>
- Build and package the code
mvn package
- Try to execute the artefact
java -jar %%jar file name%%
- Add mainClass name
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>hu.bme.mit.devops.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
- Execute again
java -jar %%jar file name%%
- Commit and push your code, review and close your issue, while merge your code.
git commit, merge
- Create a new issue and branch to create a Gradle application
mkdir gradle-app
cd gradle-app
gradle init --type java-application
Set Java compatibility level in build.gradle file
apply plugin: 'java'
...
compileJava {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
Run the application
gradle run
- Commit and push your code, review and close your issue, while merge your code.
- Create an issue for maven to gradle conversion
- Convert your maven project into a gradle project and try to execute it
gradle init --type pom
gradle tasks
gradle run
- Extend build.gradle
apply plugin: 'application'
mainClassName = 'hu.bme.mit.devops.App'
- Create new repository for the demo SpringBoot RESTFul application
- Clone spring example
git clone https://github.com/szatmari/devops-build.git
- Set new origin
git remote -v
git remote add myorigin https://your-springboot-git-url
git remote -v
git pull myorigin master --allow-unrelated-histories
- Commit and push to
myorigin
- Run the SpringBoot REST App
gradle bootRun
- Test the application:
curl http://localhost:8080/greeting?name=Zoltan
- Add dependency (
src/main/java/hello/Greeting.java
)
import org.joda.time.LocalTime;
...
public String getContent() {
LocalTime currentTime = new LocalTime();
return content +" " + currentTime;
}
- Test the application again
curl http://localhost:8080/greeting?name=Zoltan