Bonjour,

J'aimerais récupérer la valeur du Build Number lors du build d'Hudson pour le mettre dans le champ versionCode de mon AndroidManifest.xml.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
 
 <build>
        <finalName>${project.artifactId}-${project.version}.{buildNumber}</finalName>
        <sourceDirectory>src</sourceDirectory>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>maven-android-plugin</artifactId>
                <version>2.8.4</version>
                <configuration>
                    <sdk>
                        <!-- platform or api level (api level 4 = platform 1.6)-->
                        <platform>8</platform>
                    </sdk>
                    <emulator>
                        <!-- the name of the avd device to use for starting the emulator -->
                        <avd>Android2.1-update1</avd>
                    </emulator>
                    <deleteConflictingFiles>true</deleteConflictingFiles>
                    <undeployBeforeDeploy>true</undeployBeforeDeploy>
                </configuration>
                <extensions>true</extensions>
            </plugin>
 
 
		<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<configuration>
<archive>
<manifestEntries>
<Svn-Revision>${SVN_REVISION}</Svn-Revision>
<Build-Tag>${BUILD_TAG}</Build-Tag>
<Build-Number>${BUILD_NUMBER}</Build-Number>
<Build-Id>${BUILD_ID}</Build-Id>
</manifestEntries>
</archive>
</configuration>
</plugin>
 
 
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
def manifestFile = new File('AndroidManifest.xml')
def ns = new groovy.xml.Namespace('http://schemas.android.com/apk/res/android', 'ns')
def parser = new groovy.util.XmlParser(false, true)
def rootNode = parser.parse(manifestFile)
def attributes = rootNode.attributes()
def versionNumber = attributes[ns.versionCode]
versionNumber++
attributes[ns.versionCode] = versionNumber
attributes[ns.versionName] = "${finalName)"
def writer = new groovy.io.GroovyPrintWriter(manifestFile)
writer.println('&lt;?xml version="1.0" encoding="UTF-8"?&gt;')
def xmlWriter = new groovy.util.XmlNodePrinter(writer)
xmlWriter.setPreserveWhitespace(false)
xmlWriter.setNamespaceAware(true)
xmlWriter.print(rootNode)
</source>
</configuration>
</execution>
</executions>
</plugin>
 
 
 
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <!-- version 2.3 defaults to java 1.5, so no further configuration needed-->
                <version>2.3</version>
            </plugin>
 
 
        </plugins>
    </build>
J'aimerais le placer dans mon <source> lors de la modif du Manifest ... Avez-vous des pistes ?