Informe sobre herramienta Ant

Anuncio
!
%))&
"
# $%&'(&
*******************************************************************&
*******************************************************************&
, ******************************************************************(
+
- .
1+
+
/ ******************************************************************0
/ ************************************************************0
/ ******************************************************************0
/ *************************************************************0
/ *********************************************************************0
/ *****************************************************************0
/ **********************************************************************5
/ ******************************************************************5
/ *********************************************************************5
/ *********************************************************************5
/ ******************************************************************$)
2!3
24
6
+
!
3
"
7
"
#$
**************************************************************$)
!
##
!
##
#%
!
"
%
Ant
2
.
:"
, ;
2
8 9
;
8
<
.
9
;. .
;
!
9
9;
9
:
! ;
<
=
9
.
9 > 6
9
7
.
8 9
;
9
:
Automatización del proceso de build
9
8
8 9
,
•
&
6 .
; 4
.
.
:- :
.
(
;
9
:
'
8<
•
=
'
+? ;
,
•
<
9
9
:
)
@
8
=
9
,
:
•
)
•
= ;
+
2
*
.
'
;8
'
"
<
.
;
9
9:
'
8
<
;
9
9
@
:
•
,
6 .
8
! :
0)
&)
8
4
:
@
Ventajas
24
=
:•
8
!
<
8;
8
.
;
A
A
:2
'
<
8
8:
-
8 9
=
9
;
•
8
•
•
,
2
8
=:
;
,
-
;
*
A
=
•
:
.
2
<
<
=
:
'
,
.
:2
;
=
9
9
A
8
=
;
.:
Instalación
"
.
11 :
.
(
/
.:
1: "
=
A
,
89
9 $:&:C:
'
2
=
=
<
+
@
•
•
:
+
ANT_HOME
.
.
'
6
2
.:
bin
- :
.+)0
,
= ;
.
9
2
- :6
.
D
;
.
:
Características de la herramienta
Terminología
24
<
=
.
<
9
•
!
2
9
<
=
<
B
<
8
E
A
.
8 ;
;
;
;
:F: +
:
•
+
=
<
8 ,
<
:
•
9
8 :2
<
=
=
;
8
<
8 9
;
:
Formato de los archivos de build
6 .
8
.
= ;
@
4
> 6
<
:6
/;
;
:6
;
=
-
9
9
.
:
9
=
.
:
<?xml version="1.0"?>
<project name="MiPrimerProyectoAnt" default="MiTarget">
<target name="init">
<echo>Ejecutando el target init</echo>
</target>
<target name="MiTarget" depends="init">
<echo>Ejecutando target MiTarget</echo>
</target>
</project>
2 =
+
@
,
9
G . H;
G
=
,
.
E ;
4 <
,
F:
:
G H;
H
:
Ant project
9
6
< <
:
<
=
+
2
'
1*
:
2
2
:
D
8
8
:
,
:
D
D
Ant target
C
+
<
<
<
=
=
,
=
:+
:
- ;
=
/E
F
<
:
6
<
=
+
:
'
2
1*
:
6
D
:
2
<
<
=
4
2
<
=
D
:
4
<
D
:
9
:
D
+
6
:2
<
;
A
<
=
=
:
<target
<target
<target
<target
9
=
:
name="A"/>
name="B" depends="A"/>
name="C" depends="A"/>
name="D" depends="C,B,A"/>
2
@
<
=
=
;
:
=
3 +;
-:
(
&
8
=
4
;GH
:"
G
H;
9:
<target name="build-module-A" if="module-A-present"/>
2
G
=
H:
7-7
9
<
4
<target name="build-own-fake-module-A" unless="module-A-present"/>
2
=
7-7
G
D
9
<
4
<
=
9
H:
D
:
2
2
,
<
;
<
•
:
.
2
8
8
:
•
(
2
A
.
.
•
;
=
<
:
3
8
=
•
.
:
.
2
9
9
:
8
9;
<
=
.
:
Ant Task
6
/
=
.
6
9 <
.
8
.
=
9
:
:
4
<name id=“identity” attribute1="value1" attribute2="value2" ... />
A
;
<
;
:+
<
=
:
(
-
9
,
<
.
<
,
.
.
:
=;8 ;
;
:
4
+
!
+
=
=
I
24
9
!
J
+
.
!
=
'
.
:
:
8 :
8
.
=
8
:
.
=:
.
:
.
8 :
5
(
24
<
E
8
@
E
=
!"
,
@
9
.
;
,
.
,
F !
K
9 F:
(
<
= ;
9
9
8
;
,
= :
9
8
+
"
9
.
=
:
)63
-
9
2!3 E3
;I
; !3
2!3
; 3 I
. F:
)7
+
=
=
=
9
9
=
;
9
:"
8
:
=
@
9;
=
9
:
0
4
+
24
2=
!
2=
"
2
:
!
:
<
;
.
<
2
=
'
=
<
=
9:
<
9
8
<
9
=
<
8
:
=
<
:
"
=
9
:
I
3 <
8
=
9:2
:
=
9
8
.
8
.
.
=
;
9
;
;
:
4
+
-
+
+
"
.
"
:
:
/
:
.
= ;
.
7
/ .
+
.
:
.
/
/
'
/
:
:
.
:
8
+
<
:
,
"
8
:2
9
8
9
:
0(,
5
"
+?
.
:
"
9
=
+
9
8 ,
<
,
8
.
;
,
"
.
8
11
!
:
8
:
.:
1
1:
Ant Property
=
7
;
:
:6
:"
GLMG GNH
O
O;
${builddir}/classes: 2
O
:"
O
6
=
9
<
4
,
;
=
9
.
build/classes:
<
:"
9
$: "
%: 2
=
8
:2
<
:2
8
8
:
=
P
Q
=
P" = Q
Q
=
P" = Q
:
<
:
': 2
=
-
P
9:
=
•
foo.dist
O O
<property name="foo.dist" value="dist"/>
•
6
=
.
O :
O
<property file="foo.properties"/>
3
9
!
-
8
P
-
Q:
9
,
8
"
os.name
os.arch
os.versionq
D
-<
?
$)
File.separator
.
Path.separator
Line.separator
User.name
EO1O
D >F
EOO
D >F
EOR O
D >F
D
User.home
.
User.dir
"
-
Basedir
2
Ant.file
2
Ant.version
?
Ant.project.name 2
Ant.java.version 6
=
9
,
!?
Ejemplo
"
8
,
8
<
.
:
;
8
,
=
<
, =
:
Propiedades
,
8
.
9
@
,
9:
:"
9
G H
8
:
.
=
9
@
9 =
:
<target name="setup.properties">
<property name="src.main" value="src/main" />
<property name="src.test" value="src/test" />
<property name="classes" value="classes"/>
<property name="classes.main" value="${classes}/main" />
<property name="classes.test" value="${classes}/test" />
<property name="dist" value="dist" />
<property name="reports" value="reports" />
<property name="reports.junit.data" value="${reports}/junit/data" />
</target>
Path
24
<
.<
<
8
=
:"
:
$$
<target name="setup.paths">
<path id="classpath.main">
<pathelement location="${classes.main}" />
</path>
<path id="classpath.test">
<path refid="classpath.main" />
<pathelement location="${classes.test}" />
</path>
</target>
Tareas
$: &
'
<
,<
8
.
< <
=
8
:
<target name="updateRepository">
<exec executable="svn"><arg line="update"/></exec>
</target>
%: (
'
8<
E
<
= ;<
A
9
@
8
< <
F
= :
;
8
9;
@
<target name="compile.main" depends="setup, updateRepository">
<mkdir dir="${classes}" />
<javac srcdir="${src.main}" destdir="${classes}" />
</target>
<target name="compile.tests" depends="setup, updateRepository">
<mkdir dir="${classes}" />
<javac srcdir="${src.test}" destdir="${classes}"/>
</target>
': )
8<
<
<
:2
4
9
;
=
:
=
9
=
:
<target name="test" depends="compile">
<delete dir="${reports.junit.data}" failonerror="false" />
<mkdir dir="${reports.junit.data}" />
<junit printsummary="yes" haltonfailure="no"
failureproperty="tests.failed">
<classpath refid="classpath.test" />
<formatter type="xml" />
<batchtest fork="yes" todir="${reports.junit.data}"
failureproperty="tests.failed">
<fileset dir="${src.test}">
<include name="**/*Test*.java" />
$%
<exclude name="**/AllTests.java" />
</fileset>
</batchtest>
</junit>
<fail if="tests.failed" message="Some unit tests failed" />
</target>
B: )
+
9
*
'
<
"
9
=
<
:
<target name="jar" depends="compile">
<mkdir dir="${dist}" />
<jar destfile="${dist}/calculadora.jar" basedir="${classes.main}" />
</target>
$'
Anexo
-
9
9
=
.
:
<?xml version="1.0"?>
<project name="calculadora" default="compile" basedir=".">
<description>
Este es un ejemplo de build para la calculadora
</description>
<target name="setup" depends="setup.properties, setup.paths" />
<target name="setup.properties">
<property name="src.main" value="src/main" />
<property name="src.test" value="src/test" />
<property name="classes" value="classes"/>
<property name="classes.main" value="${classes}/main" />
<property name="classes.test" value="${classes}/test" />
<property name="dist" value="dist" />
<property name="reports" value="reports" />
<property name="reports.junit.data"
value="${reports}/junit/data" />
</target>
<target name="setup.paths">
<path id="classpath.main">
<pathelement location="${classes.main}" />
</path>
<path id="classpath.test">
<path refid="classpath.main" />
<pathelement location="${classes.test}" />
</path>
</target>
<target name="clean" depends="setup">
<delete dir="${classes}" failonerror="false" />
<delete dir="${reports}" failonerror="false" />
<delete dir="${dist}" failonerror="false" />
</target>
<target name="updateRepository">
<exec executable="svn"><arg line="update"/></exec>
</target>
<target name="compile" depends="setup, updateRepository,
compile.main, compile.tests" />
<target name="compile.main" depends="setup, updateRepository">
<mkdir dir="${classes}" />
<javac srcdir="${src.main}" destdir="${classes}" />
</target>
<target name="compile.tests" depends="setup, updateRepository">
<mkdir dir="${classes}" />
<javac srcdir="${src.test}" destdir="${classes}" />
</target>
<target name="test" depends="compile">
<delete dir="${reports.junit.data}" failonerror="false" />
$B
<mkdir dir="${reports.junit.data}" />
<junit printsummary="yes" haltonfailure="no"
failureproperty="tests.failed">
<classpath refid="classpath.test" />
<formatter type="xml" />
<batchtest fork="yes" todir="${reports.junit.data}"
failureproperty="tests.failed">
<fileset dir="${src.test}">
<include name="**/*Test*.java" />
<exclude name="**/AllTests.java" />
</fileset>
</batchtest>
</junit>
<fail if="tests.failed" message="Some unit tests failed" />
</target>
<target name="jar" depends="compile">
<mkdir dir="${dist}" />
<jar destfile="${dist}/calculadora.jar"
basedir="${classes.main}" />
</target>
<target name="all" depends="jar, test" />
</project>
$C
Bibliografía
-
-
. -
I /
/: S
T
. 11 : /
. .
-
. -
U
"
:S
11
:S
. 11
/:
1 /1"
-
. *-
T
:
.:
1
T
:
.:
1
1
$&
Descargar