[libvirt] [libvirt-java] [RFC] simplify java build process

Stefan Majer stefan.majer at gmail.com
Tue May 7 14:55:06 UTC 2013


Hi,

I have small patch series which tries to accomplish a easier developer
experience when building libvirt-java. The reason is simple based on
the fact that the following workflow does not work out of the box.

1. with ant:

# git clone git://libvirt.org/libvirt-java.git
# cd libvirt-java
# ant
gives:
 [javac] Compiling 64 source files to
/home/stefan/dev/libvirt-java/target/classes
    [javac] /home/stefan/dev/libvirt-java/src/main/java/org/libvirt/Library.java:5:
error: package com.sun.jna does not exist
    [javac] import com.sun.jna.Native;
...

because the ant build depends on a locally installed jna.jar which
might be not present.

2. with maven3

# cp pom.xml.in pom.xml
# mvn clean install

gives:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile
(default-compile) on project libvirt: Compilation failure: Compilation
failure:
[ERROR] /home/stefan/dev/libvirt-java/src/main/java/org/libvirt/DomainSnapshot.java:[4,7]
error: static import declarations are not supported in -source 1.3

because maven still defaults to java source 1.3 on certain
distributions (ubuntu 13.04 here).

after adding a proper setting with the maven-compiler-plugin i get:

[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/stefan/dev/libvirt-java/src/main/java/org/libvirt/Library.java:[41,28]
cannot find symbol
  symbol:   method nativeValue(com.sun.jna.Pointer)
  location: class com.sun.jna.Pointer
[ERROR] /home/stefan/dev/libvirt-java/src/main/java/org/libvirt/Library.java:[42,16]
cannot find symbol
  symbol:   method nativeValue(com.sun.jna.Pointer,long)
  location: class com.sun.jna.Pointer

This is because jna version 3.0.9 is specified but this version does
not have these signatures.


To make a long story short i would like to propose the following patches:

1. remove the ant components (build.xml, build.properties) altogether
and use maven exclusively.
2. rename pom.xml.in into pom.xml and specify java source and jna
3. remove libvirt-java.spec.in and create the libvirt-java.rpm with
the rpm-maven-plugin.
4. update the README and INSTALL accordingly

As result there will be only one file which is responsible for the
build left (pom.xml).
If there is a consensus i will post the patches as a followup.

Any objections, suggestions ?

Greetings
--
Stefan Majer




More information about the libvir-list mailing list