Coder Social home page Coder Social logo

buildautomationtoolsdemoproject's Introduction

Build Automation Tools

This repository serves as a basic demonstration of the build automation tools (i.e., Maven, Gradle) for the needs of the Software Eningineering in Practice (SEiP) course offered by the Department of Management Science & Technology of the Athens University of Economics and Business.

The goal of this repository is twofold:

  1. To present the structure of a multi-module Maven project and,
  2. to provide different settings that customize the output result of the build process.

Project Structure

This repository consists of a parent Maven project and three sub-project (modules), that handle the dependencies in a different way.

  1. Dummy Hello SEiP - that offers the most basic functionality (only prints a message)
  2. Image Manipulator - processes an image and transforsm it to the grayscale version
  3. Histogram Generator - creates a histogram from a given set of numbers

Execute the following command in the repository root directory in order to build all modules.

mvn package

This command generates a seperate jar file in each module's corresponding target (module/target) directory.

Dummy Hello SEiP

This module has no dependencies and thus it requires only the definition of the class that is the main entry point of the system (the class that contains the main method).

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-jar-plugin</artifactId>
	<configuration>
		<archive>
			<manifest>
				<addClasspath>true</addClasspath>
				<mainClass>dummyhelloworld.MessagePrinter</mainClass>
			</manifest>
		</archive>
	</configuration>
</plugin>

The produced jar is located in the target directory and can be executed as following:

java -jar dummyhelloworld/target/dummyhelloworld-0.0.1-SNAPSHOT.jar

Image Manipulator

This modulerequires one runtime dependency which is placed in a lib/ directory in the target directory where the jar is generated. To create a jar and place the dependencies in the lib directory you need to use the maven-jar-plugin and the maven-dependency-plugin plugins and also define the class that is the main entry point of the system (the class that contains the main method).

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-jar-plugin</artifactId>
	<version>2.4</version>
	<configuration>
		<archive>
			<manifest>
				<classpathPrefix>lib/</classpathPrefix>
				<addClasspath>true</addClasspath>
				<mainClass>imagemanipulator.ImageManipulatorDemo</mainClass>
			</manifest>
		</archive>
	</configuration>
</plugin>
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-dependency-plugin</artifactId>
	<version>2.4</version>
	<executions>
		<execution>
			<id>copy</id>
			<phase>install</phase>
			<goals>
				<goal>copy-dependencies</goal>
			</goals>
			<configuration>
				<outputDirectory>
					${project.build.directory}/lib
				</outputDirectory>
			</configuration>
		</execution>
	</executions>
</plugin>

The produced jar is located in the target directory and can be executed as following:

java -jar imagemanipulator/target/imagemanipulator-0.0.1-SNAPSHOT.jar imagemanipulator/src/main/resources/demo.jpeg

Histogram Generator

This module, just like the previous one, requires one runtime dependency which is packaged in the main jar (fat-jar). To create a fat-jar you need to use the maven-assembly-plugin plugin and also define the class that is the main entry point of the system (the class that contains the main method).

<plugin>
	<artifactId>maven-assembly-plugin</artifactId>
	<configuration>
		<archive>
			<manifest>
			  <mainClass>histogramgenerator.JFreeChartXYLineChartDemo</mainClass> 
			</manifest>
		</archive>
		<descriptorRefs>
			<descriptorRef>jar-with-dependencies</descriptorRef>
		</descriptorRefs>
	</configuration>
	<executions>
		<execution>
			<id>make-assembly</id>
			<phase>package</phase>
			<goals>
				<goal>single</goal>
			</goals>
		</execution>
	</executions>
</plugin>

The produced jar is located in the target directory and can be executed as following:

java -jar histogramgenerator/target/histogramgenerator-0.0.1-SNAPSHOT-jar-with-dependencies.jar

Note that the histogramgenerator-0.0.1-SNAPSHOT.jar is not executable.

How to..

  1. Setup Maven in Windows - tutorial
  2. Setup Maven in Linux. Execute sudo apt update && sudo apt install maven in a terminal.

buildautomationtoolsdemoproject's People

Contributors

antonisgkortzis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.