Skip to content

szatmari/devops-build

Repository files navigation

DevOps Build

  1. Open your GitHub account (Register if needed)
  2. Create new repository "maven-test" + README
  3. Clone your repository to your client
git clone https://your-git-url
  1. Create GitHub issue and a branch to create a new maven application
  2. 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
  1. 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>
  1. Build and package the code
mvn package
  1. Try to execute the artefact
java -jar %%jar file name%%
  1. 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>
  1. Execute again
java -jar %%jar file name%%
  1. Commit and push your code, review and close your issue, while merge your code.
git commit, merge
  1. 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
  1. Commit and push your code, review and close your issue, while merge your code.
  2. Create an issue for maven to gradle conversion
  3. Convert your maven project into a gradle project and try to execute it
gradle init --type pom
gradle tasks
gradle run
  1. Extend build.gradle
apply plugin: 'application'
mainClassName = 'hu.bme.mit.devops.App'
  1. Create new repository for the demo SpringBoot RESTFul application
  2. Clone spring example
git clone https://github.com/szatmari/devops-build.git
  1. 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
  1. Commit and push to myorigin
  2. Run the SpringBoot REST App
gradle bootRun
  1. Test the application:
curl http://localhost:8080/greeting?name=Zoltan
  1. Add dependency (src/main/java/hello/Greeting.java)
import org.joda.time.LocalTime;
...
    public String getContent() {
        LocalTime currentTime = new LocalTime();
        return content +" " + currentTime;
    }
  1. Test the application again
curl http://localhost:8080/greeting?name=Zoltan

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages