0% found this document useful (0 votes)
17 views

Software_Development_Context

Uploaded by

Tudor Cimpoesu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Software_Development_Context

Uploaded by

Tudor Cimpoesu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

T1.

C1 SOFTWARE
DEVELOPMENT CONTEXT [C2]

Tools for Enterprise Software Development

Multi-tier Software Development


Dezvoltarea Aplicațiilor Multistrat
Chapter 1. Enterprise Software
Development Context
● 1.1 Software development
○ life cycle from implementation to deployment
(software engineering).

● 1.2 Tools for Enterprise Software Development


○ IDE: Eclipse, Eclipse for JEE, JBoss Tools
○ Building tools: Ant, Maven
○ Source code management tools: Subversion, Git

2
1.2 Tools
● IDE: Integrated Development Environments

● Software building process with ant and maven

● Collaborative source code management and versioning:


Subversion and Git

3
Software building process
with MAVEN
● Maven simplified build process workflow:
○ compile;
○ resolve dependencies;
○ test;
○ package;
○ install;
○ deploy.

● “Maven is about the application of patterns in order to


achieve an infrastructure which displays the characteristics
of visibility, reusability, maintainability, and
comprehensibility”.
[***, http://maven.apache.org/background/philosophy-of-maven.html]

4
Maven Build Process Model
[Conceptual Model diagram]

5
Maven Build Process

● MVN build process (build


lifecycle) consist in several
phases:
○ compile;
○ test;
○ package;
○ install;
○ deploy.

● Each phase processing implies


the execution of a plugin to
achieve a goal (at least):
○ [plug-in.name:goal]
■ compiler:compile;
■ surfire:test;
■ jar:jar;
6
Maven Build Process
Default lifecycle*

validate validate the project is correct and all necessary information is available.
initialize initialize build state, e.g. set properties or create directories.
generate-sources generate any source code for inclusion in compilation.
process-sources process the source code, for example to filter any values.
generate-resources generate resources for inclusion in the package.
process-resources copy and process the resources into the destination directory, ready for packaging.

compile compile the source code of the project.


process-classes post-process the generated files from compilation, for example to do bytecode
enhancement on Java classes.
generate-test-sources generate any test source code for inclusion in compilation.

process-test-sources process the test source code, for example to filter any values.
generate-test-resources create resources for testing.

process-test-resources copy and process the resources into the test destination directory.

test-compile compile the test source code into the test destination directory

* Introduction to build lifecycle, http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html 7


Maven Build Process
Default lifecycle*
process-test-classes post-process the generated files from test compilation, for example to do bytecode
enhancement on Java classes.
test run tests using a suitable unit testing framework. These tests should not require the
code be packaged or deployed.
prepare-package perform any operations necessary to prepare a package before the actual packaging.
This often results in an unpacked, processed version of the package. (Maven 2.1 and
above)
package take the compiled code and package it in its distributable format, such as a JAR.
pre-integration-test perform actions required before integration tests are executed. This may involve
things such as setting up the required environment.
integration-test process and deploy the package if necessary into an environment where integration
tests can be run.
post-integration-test perform actions required after integration tests have been executed. This may
including cleaning up the environment.
verify run any checks to verify the package is valid and meets quality criteria.
install install the package into the local repository, for use as a dependency in other projects
locally.
deploy done in an integration or release environment, copies the final package to the remote
repository for sharing with other developers and projects.

* Introduction to build lifecycle, http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html 8


Maven Build Process Default Lifecycle
[MVN phases]

MVN Phase MVN Plugin Scope


compile compiler: compile
test-compile compiler: testCompile
test surefire: test
package jar: jar
install install: install
deploy deploy: deploy

9
Practice 2

● MVN-eclipse integration
○ run builds from eclipse
● MVN-command
○ mvn-installation
○ run builds from command-shell

mvn phase
mvn plugin:goal

10
Maven POM: Project Object Model: pom.xml

11
Maven Project Object Model: pom.xml

12
Maven Profiles and Properties

● Developers will use properties to customize project


description or to customize the (default) build.
○ Properties could be overridden on command/execution
time to result different build configurations.

● Developers will use profiles to define custom project


configurations_
○ to set or override default values of Maven (default)
build process.

13
MVN project structure
Default properties

● ${project.basedir}
● Default target folder
○ ${project.build.directory}
● Default target/classes folder
○ ${project.build.outputDirectory}
● Default target/test-classes folder
○ ${project.build.testOutputDirectory}
● Default src/main/java folder
○ ${project.build.sourceDirectory}
● Default src/test/java folder
○ ${project.build.testSourceDirectory}

14
MVN project structure
Convention over configuration

● source code location and resources


○ ${basedir}/src/main/java
○ ${basedir}/src/main/resources
● tests
○ ${basedir}/src/test/java
○ ${basedir}/src/test/resources
● bytecode (compiled code)
○ ${basedir}/target/classes
● distributable JAR files
○ ${basedir}/target

15
Maven Repositories and
Dependency management

16
Maven Repositories and
Dependency management

<repositories>
<repository>
<id>my-repo1</id>
<name>your custom repo</name>
<url>http://remote-repo-url.org</url>
</repository>
<repositories>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit}</version>
<scope>test</scope>
</dependency>
</dependencies>
17
Maven Common Commands
execute task (unit-of-work) as {plugin}:{goal}

● mvn archetype:generate
○ generate project (structure and configuration)

● mvn compile
○ execute compile phase
■ from default build lifecycle
○ mvn compiler:compile [and up]

● mvn package
○ execute phase from default build lifecycle
○ mvn jar:jar [and up]

18
Maven Common Commands (2)
● mvn install
○ execute install phase
■ from default build lifecycle
○ mvn install:install [and up]

● mvn
○ dependency:resolve
○ dependency:analyze
○ dependency:tree
○ dependency:copy-dependencies

19
Practice: MVN

● MVN project description: pom.xml


● MVN-ANT integration

20
Maven managing hierarchical project
structure: project and sub-projects

● Parent project: root folder with main/base/inherited


pom.xml
○ sub-projects: subfolders with subordinate/child
pom.xml

21
Other build-support management tools

● Gradle
● Apache Buildr
● Jeka

22
Collaborative programming workflow.
Software Development & Teaming

● Shared and versioned management of source code


artifacts
○ ex: CVS, SVN, Git etc.
● Subversion approach: protocol and tools.
● Git approach: architecture and IDE-integration.

23
Features of Version Control Systems
(or Source Code Management Systems)

● VCS Typical features:


○ store/backup code;
○ change management;
○ version support;
○ bug tracking;
● Developer Team-working Tools’ features:
○ sharing source code;
○ version branching and re-merging;
● Developer Productivity Tools
● Most used protocols, products and tools
○ Git, Subversion, CVS, Mercurial

24
SVN System

25
SVN Concepts

● Centralized management for source code artifacts.


● Components:
○ SVN Repository with_
■ repository URL
■ (virtual) filesystem tree
○ Trunk
○ Branches
○ Working Copy
○ Commit Changes
○ Revisions/Versions

26
SVN Repositories

● public SVN repositories


○ Sourceforge
● local/in-house SVN server on Windows or Linux
○ create local repository
○ start svn server
○ publish/share repository

27
SVN Client - common commands

● svn checkout <repository-dir-url>


● svn add <filename>
● svn update <filename>
● svn commit -m “message” <filename>
-------------------------------------------
● svn diff <filename>
● svn revert <filename>
● svn remove -m “message” <filename>

28
TortoiseSVN

29
Eclipse
Subclipse

30
GIT System and Approach

● Git is a Distributed Version Control System - DVCS.


○ as SVN is a Centralized Version Control System CVCS.
● Git concepts (terminology):
○ repository types:
■ bare (remote) repository;
■ non-bare (local) repository;
○ working tree - versioned collection of files;
■ head and branches;
○ operations:
■ life-cycle operations: clone, create, delete;
■ local ops.: add files, new file versions, revert changes;
■ synchronizing ops.: fetch and pull; push and commit.

31
GiT Distributed Architecture and
Git Process

32
Eclipse Git - eGit

33
Eclipse Git - eGit

34
Git commands

● git init
● git clone username@host:/path/to/repository
------------------------------------------------
● git add <filename>
● git fetch
● git pull
● git commit -m "Commit message"
● git push origin master
------------------------------------------------
● git diff
● git checkout -- <filename>
● git reset --hard origin/master
35
Git Workflow

36
Git GUI Tools

● Git-GUI Console
● SourceTree
● GitHub Desktop
● TortoiseGit
● Git Extensions

37
Refs: Ant Build Tool

● Steve Loughran, Erik Hatcher, Ant in Action. Second


Edition of Java Development with Ant, 2007 Manning
Publications Co.
● Matthew Moodie, Pro Apache Ant, Apress, 2006
● Online tutorials:
○ http://ant.apache.org/manual/index.html
○ http://www.tutorialspoint.com/ant/
○ https://ant.apache.org/manual/tutorial-HelloWorldWithAnt.html
○ http://www.vogella.com/tutorials/ApacheAnt/article.html

38
Refs: Maven Build Tool

● Srirangan, Apache Maven 3 Cookbook, Packt Publishing,


2011
● Prabath Siriwardena, Mastering Apache Maven 3, Packt
Publishing, 2014
● Balaji Varanasi and Sudha Belida, Introducing Maven,
Apress, 2014
● Prabath Siriwardena, Maven Essentials, Packt
Publishing, 2015
● Online tutorials:
○ http://maven.apache.org/guides/
○ http://www.tutorialspoint.com/maven/
○ http://www.vogella.com/tutorials/ApacheMaven/article.html

39
Refs: SVN and GiT

● SVN
○ http://www.tutorialspoint.com/svn/
○ http://www.ibm.com/developerworks/library/os-ecl-su
bversion/
● GiT
○ http://www.vogella.com/tutorials/Git/article.html
○ http://www.tutorialspoint.com/git/
○ http://www.vogella.com/tutorials/EclipseGit/article.ht
ml#creating-an-eclipse-project
○ Pro Git online version

40
Tutorial Sources

● Tutorial Point
○ http://www.tutorialspoint.com/index.htm
● Java Code Geeks
○ http://www.javacodegeeks.com/2014/04/java-ee7-an
d-maven-project-for-newbies-part-1-a-simple-maven
-project-structure-the-parent-pom.html
○ http://www.javacodegeeks.com/2014/06/java-ee7-an
d-maven-project-for-newbies-part-5-unit-testing-usin
g-arquillian-wildfly-8.html

41

You might also like