Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / pom.xml @ 40457

History | View | Annotate | Download (22.8 KB)

1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
4
         http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
    <modelVersion>4.0.0</modelVersion>
6
    <artifactId>org.gvsig.desktop.plugin</artifactId>
7
    <packaging>pom</packaging>
8
    <name>${project.artifactId}</name>
9
    <description>
10
      Base POM for all gvSIG plugins projects. 
11
      This pom knows how to build and made a plugin for gvSIG. 
12
      The property "gvsig.product.folder.path" must be set up correctly.
13
    </description>
14
    <parent>
15
        <groupId>org.gvsig</groupId>
16
        <artifactId>org.gvsig.desktop</artifactId>
17
        <version>2.0.10-SNAPSHOT</version>
18
    </parent>
19

    
20
    <dependencyManagement>
21
        <dependencies>
22

    
23
          <dependency>
24
            <groupId>org.gvsig</groupId>
25
            <artifactId>org.gvsig.app.mainplugin</artifactId>
26
            <version>${gvsig.desktop.children.version}</version>
27
            <scope>provided</scope>
28
          </dependency>
29
          <dependency>
30
            <groupId>org.gvsig</groupId>
31
            <artifactId>org.gvsig.annotation.app.mainplugin</artifactId>
32
            <version>${gvsig.desktop.children.version}</version>
33
            <scope>provided</scope>
34
          </dependency>
35
          <dependency>
36
            <groupId>org.gvsig</groupId>
37
            <artifactId>org.gvsig.app.document.table.app.mainplugin</artifactId>
38
            <version>${gvsig.desktop.children.version}</version>
39
            <scope>provided</scope>
40
          </dependency>
41
          <dependency>
42
            <groupId>org.gvsig</groupId>
43
            <artifactId>org.gvsig.centerviewpoint.app.mainplugin</artifactId>
44
            <version>${gvsig.desktop.children.version}</version>
45
            <scope>provided</scope>
46
          </dependency>
47
          <dependency>
48
            <groupId>org.gvsig</groupId>
49
            <artifactId>org.gvsig.coreplugin.app.mainplugin</artifactId>
50
            <version>${gvsig.desktop.children.version}</version>
51
            <scope>provided</scope>
52
          </dependency>
53
          <dependency>
54
            <groupId>org.gvsig</groupId>
55
            <artifactId>org.gvsig.daltransform.app.mainplugin</artifactId>
56
            <version>${gvsig.desktop.children.version}</version>
57
            <scope>provided</scope>
58
          </dependency>
59
          <dependency>
60
            <groupId>org.gvsig</groupId>
61
            <artifactId>org.gvsig.datalocator.app.mainplugin</artifactId>
62
            <version>${gvsig.desktop.children.version}</version>
63
            <scope>provided</scope>
64
          </dependency>
65
          <dependency>
66
            <groupId>org.gvsig</groupId>
67
            <artifactId>org.gvsig.editing.app.mainplugin</artifactId>
68
            <version>${gvsig.desktop.children.version}</version>
69
            <scope>provided</scope>
70
          </dependency>
71
          <dependency>
72
            <groupId>org.gvsig</groupId>
73
            <artifactId>org.gvsig.exportto.app.mainplugin</artifactId>
74
            <version>${gvsig.desktop.children.version}</version>
75
            <scope>provided</scope>
76
          </dependency>
77
          <dependency>
78
            <groupId>org.gvsig</groupId>
79
            <artifactId>org.gvsig.geodb.app.mainplugin</artifactId>
80
            <version>${gvsig.desktop.children.version}</version>
81
            <scope>provided</scope>
82
          </dependency>
83
          <dependency>
84
            <groupId>org.gvsig</groupId>
85
            <artifactId>org.gvsig.mkmvnproject.app.mainplugin</artifactId>
86
            <version>${gvsig.desktop.children.version}</version>
87
            <scope>provided</scope>
88
          </dependency>
89
          <dependency>
90
            <groupId>org.gvsig</groupId>
91
            <artifactId>org.gvsig.installer.app.mainplugin</artifactId>
92
            <version>${gvsig.desktop.children.version}</version>
93
            <scope>provided</scope>
94
          </dependency>
95
          <dependency>
96
            <groupId>org.gvsig</groupId>
97
            <artifactId>org.gvsig.symbology.app.mainplugin</artifactId>
98
            <version>${gvsig.desktop.children.version}</version>
99
            <scope>provided</scope>
100
          </dependency>
101
          <dependency>
102
            <groupId>org.gvsig</groupId>
103
            <artifactId>org.gvsig.i18n.app.mainplugin</artifactId>
104
            <version>${gvsig.desktop.children.version}</version>
105
            <scope>provided</scope>
106
          </dependency>
107
          <dependency>
108
            <groupId>org.gvsig</groupId>
109
            <artifactId>org.gvsig.selectiontools.app.mainplugin</artifactId>
110
            <version>${gvsig.desktop.children.version}</version>
111
            <scope>provided</scope>
112
          </dependency>
113
          <dependency>
114
            <groupId>org.gvsig</groupId>
115
            <artifactId>org.gvsig.geometrymeasurement.app.mainplugin</artifactId>
116
            <version>${gvsig.desktop.children.version}</version>
117
            <scope>provided</scope>
118
          </dependency>
119
          <dependency>
120
            <groupId>org.gvsig</groupId>
121
            <artifactId>org.gvsig.newlayer.app.mainplugin</artifactId>
122
            <version>${gvsig.desktop.children.version}</version>
123
            <scope>provided</scope>
124
          </dependency>
125
          <dependency>
126
            <groupId>org.gvsig</groupId>
127
            <artifactId>org.gvsig.help.app.mainplugin</artifactId>
128
            <version>${gvsig.desktop.children.version}</version>
129
            <scope>provided</scope>
130
          </dependency>
131

    
132
        </dependencies>
133
    </dependencyManagement>
134

    
135
    <properties>
136
        <!-- Package info property values -->
137
        <gvsig.package.info.state>devel</gvsig.package.info.state>
138
        <gvsig.package.info.official>false</gvsig.package.info.official>
139
        <gvsig.package.info.operatingSystem>all</gvsig.package.info.operatingSystem>
140
        <gvsig.package.info.architecture>all</gvsig.package.info.architecture>
141
        <gvsig.package.info.javaVM>j1_5</gvsig.package.info.javaVM>
142
        <gvsig.package.info.gvSIGVersion>2.0.0</gvsig.package.info.gvSIGVersion>
143
        <gvsig.package.info.dependencies>required: org.gvsig.app.mainplugin -ge 2.0.1</gvsig.package.info.dependencies>
144
        <gvsig.package.info.owner>gvSIG Association</gvsig.package.info.owner>
145
        <gvsig.package.info.sourcesURL>${project.scm.url}</gvsig.package.info.sourcesURL>
146
        <gvsig.package.info.webURL>http://www.gvsig.com</gvsig.package.info.webURL>
147
        <gvsig.package.info.categories></gvsig.package.info.categories>
148
        <gvsig.package.info.poolURL>http://downloads.gvsig.org/download/gvsig-desktop/pool</gvsig.package.info.poolURL>
149
    </properties>
150

    
151
    <dependencies>
152
      <dependency>
153
          <groupId>org.slf4j</groupId>
154
          <artifactId>slf4j-api</artifactId>
155
          <scope>provided</scope>
156
      </dependency>
157
      <dependency>
158
          <groupId>org.slf4j</groupId>
159
          <artifactId>slf4j-log4j12</artifactId>
160
          <scope>provided</scope>
161
      </dependency>
162
      <dependency>
163
        <groupId>org.gvsig</groupId>
164
        <artifactId>org.gvsig.andami</artifactId>
165
        <scope>provided</scope>
166
      </dependency>
167
      <dependency>
168
        <groupId>org.gvsig</groupId>
169
        <artifactId>org.gvsig.tools.lib</artifactId>
170
        <scope>provided</scope>
171
      </dependency>
172
    </dependencies>
173

    
174

    
175
    <build>
176
      <plugins>
177

    
178
            <plugin>
179
              <!-- load ".gvsig-devel.properties" -->
180
              <groupId>org.codehaus.mojo</groupId>
181
              <artifactId>properties-maven-plugin</artifactId>
182
              <configuration>
183
                  <files>
184
                      <!-- Define gvsig.product.folder.path in this property -->
185
                      <file>${user.home}/.gvsig-devel.properties</file>
186
                      <file>${project.basedir}/gvsig-devel.properties</file>
187
                      <file>buildNumber.properties</file>
188
                  </files>
189
                  <quiet>true</quiet>
190
              </configuration>
191
              <executions>
192
                  <execution>
193
                            <id>default</id>
194
                      <phase>prepare-package</phase>
195
                      <goals>
196
                          <goal>read-project-properties</goal>
197
                      </goals>
198
                  </execution>
199
                  <execution>
200
                          <id>default-clean</id>
201
                    <phase>pre-clean</phase>
202
                    <goals>
203
                        <goal>read-project-properties</goal>
204
                    </goals>
205
                </execution>
206
              </executions>
207
            </plugin>
208

    
209

    
210
        </plugins>
211
    </build>
212

    
213

    
214
  <profiles>
215
      <profile>
216
        <id>gvsig-plugin</id>
217
        <activation>
218
          <file>
219
            <exists>buildNumber.properties</exists>
220
          </file>
221
        </activation>
222
        <build>
223
          <plugins>
224

    
225
            <plugin>
226
                <artifactId>maven-assembly-plugin</artifactId>
227
                <configuration>
228
                    <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
229
                    <appendAssemblyId>false</appendAssemblyId>
230
                </configuration>
231
                <executions>
232
                  <execution>
233
                    <id>gvsig-plugin-package</id>
234
                    <phase>package</phase>
235
                    <goals>
236
                        <goal>single</goal>
237
                    </goals>
238
                    <configuration>
239
                      <finalName>gvSIG-desktop-${gvsig.package.info.gvSIGVersion}-${project.artifactId}-${project.version}-${buildNumber}-${gvsig.package.info.state}-${gvsig.package.info.operatingSystem}-${gvsig.package.info.architecture}-${gvsig.package.info.javaVM}.gvspkg</finalName>
240
                      <descriptors>
241
                        <descriptor>src/main/assembly/gvsig-plugin-package.xml</descriptor>
242
                      </descriptors>
243
                    </configuration>
244
                  </execution>
245
                </executions>
246
            </plugin>
247

    
248
            <plugin>
249
              <artifactId>maven-clean-plugin</artifactId>
250
              <configuration>
251
                <skip>false</skip>
252
                <failOnError>true</failOnError>
253
                <filesets>
254
                  <fileset>
255
                    <directory>${gvsig.product.folder.path}/gvSIG/extensiones/${project.artifactId}</directory>
256
                  </fileset>
257
                </filesets>
258
              </configuration>
259
              <executions>
260
                <execution>
261
                  <id>default-clean</id>
262
                  <phase>clean</phase>
263
                </execution>
264
              </executions>
265
            </plugin>
266

    
267
            <plugin>
268
              <groupId>org.codehaus.gmaven</groupId>
269
              <artifactId>gmaven-plugin</artifactId>
270
              <executions>
271
                <execution>
272
                  <id>build-package-info</id>
273
                  <phase>prepare-package</phase>
274
                  <goals>
275
                    <goal>execute</goal>
276
                  </goals>
277
                  <configuration>
278
                    <source><![CDATA[
279
                        if( project.properties["buildNumber"] == null) {
280
                          log.info("Skip build package.info (buildNumber.property not present).")
281
                          log.info("Skip build package.info index (buildNumber.property not present).")
282
                        } else {
283
                          package_info_file  = new File(project.basedir, "target/package.info")
284
                          log.info("Building package.info : " + package_info_file.getAbsolutePath())
285
                          Properties props = new Properties()
286
                          props.setProperty('code', project.artifactId)
287
                          props.setProperty('name', project.name)
288
                          props.setProperty('version', project.version)
289
                          props.setProperty('description', project.description)
290
                          props.setProperty('owner', project.properties["gvsig.package.info.owner"])
291
                          props.setProperty('java-version', project.properties["gvsig.package.info.javaVM"])
292
                          props.setProperty('official', project.properties["gvsig.package.info.official"])
293
                          props.setProperty('type', "plugin")
294
                          props.setProperty('state', project.properties["gvsig.package.info.state"])
295
                          props.setProperty('operating-system', project.properties["gvsig.package.info.operatingSystem"])
296
                          props.setProperty('dependencies', project.properties["gvsig.package.info.dependencies"])
297
                          props.setProperty('sources-url', project.properties["gvsig.package.info.sourcesURL"])
298
                          props.setProperty('web-url', project.properties["gvsig.package.info.webURL"])
299
                          props.setProperty('architecture', project.properties["gvsig.package.info.architecture"])
300
                          props.setProperty('model-version', '1.0.1')
301
                          props.setProperty('categories', project.properties["gvsig.package.info.categories"])
302
                          props.setProperty('buildNumber', project.properties["buildNumber"])
303
                          props.setProperty('gvSIG-version', project.properties["gvsig.package.info.gvSIGVersion"])
304

    
305
                          props.store(package_info_file.newWriter(), null)
306

    
307
                          pkgname = "gvSIG-desktop-" + 
308
                            project.properties["gvsig.package.info.gvSIGVersion"] + "-" + 
309
                            project.artifactId + "-" + 
310
                            project.version + "-" + 
311
                            project.properties["buildNumber"] + "-" + 
312
                            project.properties["gvsig.package.info.state"] + "-" + 
313
                            project.properties["gvsig.package.info.operatingSystem"] + "-" + 
314
                            project.properties["gvsig.package.info.architecture"] + "-" + 
315
                            project.properties["gvsig.package.info.javaVM"]
316
                          package_info_file  = new File(project.basedir, "target/gvspki/"+project.artifactId+"/package.info")
317
                          log.info("Building package.info index " + package_info_file.getAbsolutePath())
318
                          package_info_file.getParentFile().mkdirs()
319
                          props.setProperty('download-url', 
320
                            project.properties["gvsig.package.info.poolURL"] + "/" +
321
                            project.artifactId + "/" +
322
                            pkgname + ".gvspki"
323
                          )
324
                          props.store(package_info_file.newWriter(), null)
325
                        }
326
                    ]]></source>
327
                  </configuration>
328
                </execution>
329

    
330
                <execution>
331
                  <id>build-package-index</id>
332
                  <phase>package</phase>
333
                  <goals>
334
                    <goal>execute</goal>
335
                  </goals>
336
                  <configuration>
337
                    <source><![CDATA[
338
                      def zip(java.util.zip.ZipOutputStream zipOutStream, File f , String path) {
339
                        def name = (path.equals(""))?f.name:path + File.separator + f.name
340
                        if(!f.isDirectory() ) {
341
                          def entry = new java.util.zip.ZipEntry(name)
342
                          zipOutStream.putNextEntry(entry)
343
                          new FileInputStream(f).withStream { inStream ->
344
                            def buffer = new byte[1024]
345
                            def count
346
                            while((count = inStream.read(buffer, 0, 1024)) != -1) {
347
                              zipOutStream.write(buffer,0,count)
348
                            }
349
                          }
350
                          zipOutStream.closeEntry()
351
                        } else {
352
                          //write the directory first, in order to allow empty directories
353
                          def entry = new java.util.zip.ZipEntry(name + File.separator)
354
                          zipOutStream.putNextEntry(entry)
355
                          zipOutStream.closeEntry()
356
                          f.eachFile{
357
                            zip(zipOutStream,it,name)
358
                          }
359
                        }
360
                      }
361
                      def zipfolder(File folder, File destination) {
362
                        def zipos = new java.util.zip.ZipOutputStream(new FileOutputStream(destination))
363
                        path = ""
364
                        zipos.withStream { zipOutStream->  
365
                          zip(zipOutStream,folder,path)
366
                        }
367
                      }
368
                      if( project.properties["buildNumber"] == null) {
369
                        log.info("Skip building package index (buildNumber.property not present).")
370
                      } else {
371
                        pkgname = "gvSIG-desktop-" + 
372
                          project.properties["gvsig.package.info.gvSIGVersion"] + "-" + 
373
                          project.artifactId + "-" + 
374
                          project.version + "-" + 
375
                          project.properties["buildNumber"] + "-" + 
376
                          project.properties["gvsig.package.info.state"] + "-" + 
377
                          project.properties["gvsig.package.info.operatingSystem"] + "-" + 
378
                          project.properties["gvsig.package.info.architecture"] + "-" + 
379
                          project.properties["gvsig.package.info.javaVM"]
380

    
381
                        log.info("Building package index " + pkgname + ".gvspki")
382
                        package_index_source_file  = new File(project.basedir, "target/gvspki/" + project.artifactId)
383
                        package_index_target_file  = new File(project.basedir, "target/"+pkgname+".gvspki")
384
                        zipfolder(package_index_source_file, package_index_target_file)
385
                      }
386
                    ]]></source>
387
                  </configuration>
388
                </execution>
389

    
390
                <execution>
391
                  <id>install-plugin</id>
392
                  <phase>install</phase>
393
                  <goals>
394
                    <goal>execute</goal>
395
                  </goals>
396
                  <configuration>
397
                    <source><![CDATA[
398
                      def copy(String src,String dest) {
399
                        filesrc = new File(src)
400
                        def input = filesrc.newDataInputStream()
401
                        def output = new File(dest).newDataOutputStream()
402
                         
403
                        output << input
404
                         
405
                        input.close()
406
                        output.close()
407
                      }
408
                      def unzip(String source, String target) {
409
                        zip = new java.util.zip.ZipInputStream(new FileInputStream(source))
410
                        destFile = new File(target)
411
                        if(!destFile.exists()){
412
                          destFile.mkdir();
413
                        }
414
                        zip.withStream{
415
                           def entry
416
                           while(entry = zip.nextEntry){
417
                             if (!entry.isDirectory()){
418
                               new File(target + File.separator + entry.name).parentFile?.mkdirs()
419
                               output = new FileOutputStream(target + File.separator + entry.name) 
420
                               output.withStream{
421
                                 int len = 0;
422
                                 byte[] buffer = new byte[4096]
423
                                 while ((len = zip.read(buffer)) > 0){
424
                                   output.write(buffer, 0, len);
425
                                 }
426
                               }
427
                            }
428
                            else {
429
                              new File(target + File.separator + entry.name).mkdir()
430
                            }
431
                           }
432
                         }
433
                      }
434

    
435
                      pkgname = "gvSIG-desktop-" + 
436
                        project.properties["gvsig.package.info.gvSIGVersion"] + "-" + 
437
                        project.artifactId + "-" + 
438
                        project.version + "-" + 
439
                        project.properties["buildNumber"] + "-" + 
440
                        project.properties["gvsig.package.info.state"] + "-" + 
441
                        project.properties["gvsig.package.info.operatingSystem"] + "-" + 
442
                        project.properties["gvsig.package.info.architecture"] + "-" + 
443
                        project.properties["gvsig.package.info.javaVM"]
444

    
445
                      source = project.basedir.getAbsolutePath() + "/target/" + pkgname + ".gvspkg.zip"
446
                      target = project.properties["gvsig.product.folder.path"] + "/gvSIG/extensiones/"
447

    
448
                      log.info("Install plugin to " + target)
449
                      unzip(source, target)
450

    
451
                      target = new File(project.properties["gvsig.product.folder.path"] + 
452
                        "/install/" + 
453
                        project.artifactId + "/" +
454
                        pkgname + ".gvspkg")
455
                      target.getParentFile().mkdirs()
456

    
457
                      log.info("Copy plugin package from " + source + " to " + target)
458
                      copy(source, target.getAbsolutePath())
459

    
460
                      source  = project.basedir.getAbsolutePath() + "/target/" + pkgname + ".gvspki"
461
                      target = project.properties["gvsig.product.folder.path"] + 
462
                        "/install/" + 
463
                        project.artifactId + "/" +
464
                        pkgname + ".gvspki"
465
                      log.info("Copy plugin package index from " + source + " to " + target)
466
                      copy(source, target)
467

    
468
                    ]]></source>
469
                  </configuration>
470
                </execution>
471

    
472
              </executions>
473
            </plugin>
474

    
475
          </plugins>
476
        </build>
477
      </profile>
478

    
479
  </profiles>
480

    
481
    <modules>
482
      <module>org.gvsig.app</module>
483
      <module>org.gvsig.coreplugin.app</module>
484
      <module>org.gvsig.centerviewpoint.app</module>
485
      <module>org.gvsig.app.document.table.app</module>
486
      <module>org.gvsig.geometrymeasurement.app</module>
487
      <module>org.gvsig.datalocator.app</module>
488
      <module>org.gvsig.help.app</module>
489
      <module>org.gvsig.selectiontools.app</module>
490
      <module>org.gvsig.i18n.app</module>
491
      <module>org.gvsig.symbology.app</module>
492
      <module>org.gvsig.geodb.app</module>
493
      <module>org.gvsig.annotation.app</module>
494
      <module>org.gvsig.daltransform.app</module>
495
      <module>org.gvsig.exportto.app</module>
496
      <module>org.gvsig.editing.app</module>
497
      <module>org.gvsig.installer.app</module>
498
      <module>org.gvsig.newlayer.app</module>
499
      <module>org.gvsig.mkmvnproject.app</module>
500
    </modules>
501

    
502
</project>