Re: building new tuxguitar with maven

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Il 24/01/2016 05:03, Christopher ha scritto:
On Sat, Jan 23, 2016 at 9:16 PM Orcan Ogetbil <oget.fedora@xxxxxxxxx> wrote:
Hi folks,

It's been a while. I am giving a shot to update our tuxguitar package
from 1.2 to the recent 1.3. The new release comes with a build system
switch from ant to maven. I do not have much experience with maven, so
I tried to follow the packaging instructions [1] which I found quite
useful. I managed to build the package from source, but I still have 4
problems:

1- tuxguitar-1.3 has an itext5 dependency, but we only ship itext2 in
Fedora. I tried to disable the tuxguitar-pdf plugin (which uses itext)
by various combinations of %pom_remove_dep, %pom_remove_plugin,
%pom_disable_module. The following takes me a couple steps further

%pom_remove_dep -r com.itextpdf:itextpdf
%pom_remove_dep -r com.itextpdf.tool:xmlworker


Also, one alternative is to update the itext dependency to itext5.
Another is to patch your project with itext2, and use the xpath macro to change the dep version:
%pom_xpath_set "pom:project/pom:dependencyManagement/pom:dependencies/pom:dependency[pom:artifactId='itextpdf']/pom:version" "5.???"
or similar
 
Hi
as already you know, iText 5.x series is NON free
but I end up getting:

[ERROR] Failed to execute goal on project tuxguitar-pdf: Could not
resolve dependencies for project
org.herac.tuxguitar:tuxguitar-pdf:jar:1.3.0: The following artifacts
could not be resolved: com.itextpdf:itextpdf:jar:SYSTEM,
com.itextpdf.tool:xmlworker:jar:SYSTEM: Cannot access swt-repo
(https://swt-repo.googlecode.com/svn/repo/) in offline mode and the
artifact com.itextpdf:itextpdf:jar:SYSTEM has not been downloaded from
it before. -> [Help 1]

So, I worked around by patching the pom.xml file and removed the
dependency by hand. I am pretty sure there is a better way of doing
this with the maven macros.


You can't just remove the dependency. You have to disable any module which uses that dependency:
%pom_disable_module <moduledir>

I noticed that the project is structured like a multi-module project, but I don't see a <modules> section in the pom.xml. I looked at your spec, but I couldn't figure out how the builds in the subdirectories are being triggered. Usually, maven triggers them from the parent. I'm not sure about this project, though.

Looking at the top-level pom.xml, it also looks like you'll need to build with a specific arch-dependent profile active, which you'll probably need to manipulate with some %ifarch condition.
 
2- When the package is built with %mvn_build and installed with
%mvn_install the jar files get installed into
/usr/share/java/tuxguitar/. But looking at the launcher script, the
application expects the jar files to be in /usr/share//. Is
there a way to tell maven to install the jar files there instead
(these are application jars, not shared libraries) ?


Doesn't matter if they are application jars or shared... they should be put in a standard location, because you never know what kind of projects may want to reuse these jars as their own dependencies. (for example, formatter-maven-plugin, which is not packaged in Fedora, uses Eclipse's jars to provide formatting during a maven build according to Eclipse's standards when using the IDE... not something Eclipse developers probably expected, but very a very useful example of code reuse from an application jar).
 
3- I manually moved the jar files into /usr/share/tuxguitar/. The
launcher calls the entry point in tuxguitar.jar. But this jar doesn't
find the other jars, for example the tuxguitar-editor-utils.jar, and
the application doesn't launch. I can add this jar file and the other
15 jar files to the CLASSPATH in the lancher script, but I am not sure
this is the right way. I didn't have to do this with ant. With ant,
the tuxguitar.jar somehow knew about the other jars. How can we fix
this?


Don't move the jars. You can symlink them, or change the launch scripts to point to the location in the Fedora system. If this is problematic, you may also want to work with upstream to make it easier by making the actual classpath location more easily configurable.
 
4- There are a bunch of supplementary files (.desktop file, icons,
mime xmls, the launcher script etc) which are listed in the main
pom.xml file, but %mvn_install doesn't install them. I had to copy
them manually to the $RPM_BUILD_ROOT. Is there a way to do this with
better?

[snip]

I think that's pretty normal. Use 'install' to put them in the proper location in the buildroot (here's examples from accumulo):
install -d -m 755 %{buildroot}%{_libdir}/%{name}
install -p -m 755 server/native/target/%{name}-native-%{version}/%{name}-native-%{version}/lib%{name}.so %{buildroot}%{_libdir}/%{name}
 

i use

%ifarch x86_64
%global bit x86_64
%else
%global bit x86
%endif
Summary:          A multitrack tablature editor and player written in Java-SWT
...

%setup -q -n %{name}-%{version}-src
# Remove NON FREE deps
%pom_remove_dep -r com.itextpdf:itextpdf
%pom_remove_dep -r com.itextpdf.tool:xmlworker
%pom_remove_dep -r com.itextpdf:itextpdf build-scripts/%{name}-linux-%{bit}
%pom_remove_dep -r com.itextpdf.tool:xmlworker build-scripts/%{name}-linux-%{bit}
%pom_disable_module ../../TuxGuitar-pdf build-scripts/%{name}-linux-%{bit}
%pom_remove_dep -r :tuxguitar-pdf

# Fails to collect eclipse swt artifact
%pom_remove_plugin :maven-dependency-plugin build-scripts/%{name}-linux-%{bit}

%pom_xpath_set -r pom:org.eclipse.swt.artifactId org.eclipse.swt
%pom_xpath_set -r pom:org.eclipse.swt.artifactId org.eclipse.swt build-scripts/%{name}-linux-%{bit}
%pom_remove_dep :org.eclipse.swt.gtk.linux.x86
%pom_remove_dep :org.eclipse.swt.gtk.linux.x86_64
%pom_remove_dep :org.eclipse.swt.gtk.linux.ppc
%pom_remove_dep :org.eclipse.swt.win32.win32.x86
%pom_remove_dep :org.eclipse.swt.cocoa.macosx
%pom_remove_dep :org.eclipse.swt.cocoa.macosx.x86_64
%pom_remove_dep :org.eclipse.swt.carbon.macosx

%pom_xpath_inject pom:modules "<module>../../TuxGuitar-alsa</module>
 <module>../../TuxGuitar-fluidsynth</module>
 <module>../../TuxGuitar-jack</module>
 <module>../../TuxGuitar-jack-ui</module>
 <module>../../TuxGuitar-oss</module>
 <module>../../TuxGuitar-tray</module>
 <module>../../TuxGuitar-viewer</module>"  build-scripts/%{name}-linux-%{bit}

# Symilar hack should be done for tuxguitar-fluidsynth  and tuxguitar-jack modules

# Fix parent pom for jni modules
%pom_xpath_set pom:parent/pom:artifactId tuxguitar-alsa-linux-%{bit} TuxGuitar-alsa
%pom_xpath_inject pom:parent "<relativePath>../build-scripts/native-modules/tuxguitar-alsa-linux-%{bit}</relativePath>" TuxGuitar-alsa
%pom_xpath_set pom:parent/pom:artifactId tuxguitar-oss-linux-%{bit} TuxGuitar-oss
%pom_xpath_inject pom:parent "<relativePath>../build-scripts/native-modules/tuxguitar-oss-linux-%{bit}</relativePath>" TuxGuitar-oss

# fix tuxguitar-*.jni.path property
sed -i "s|\${parent.relativePath}|$PWD|" \
 build-scripts/native-modules/tuxguitar-alsa-linux-%{bit}/pom.xml \
 build-scripts/native-modules/tuxguitar-oss-linux-%{bit}/pom.xml
# Disable gcj support
sed -i "s|\$(shell gcj -print-file-name=include/)|%{_jvmdir}/java/include -I%{_jvmdir}/java/include/linux|" \
 build-scripts/native-modules/tuxguitar-alsa-linux-%{bit}/pom.xml \
 build-scripts/native-modules/tuxguitar-oss-linux-%{bit}/pom.xml

%build

%mvn_build -- -f build-scripts/%{name}-linux-%{bit}/pom.xml -Dproject.build.sourceEncoding=UTF-8
...
%install
%mvn_install

...
install -d -m 755 %{buildroot}%{_libdir}/%{name}
install -p -m 755 TuxGuitar-alsa/target/build/lib/libtuxguitar-alsa-jni.so %{buildroot}%{_libdir}/%{name}
install -p -m 755 TuxGuitar-oss/target/build/lib/libtuxguitar-oss-jni.so %{buildroot}%{_libdir}/%{name}
...

[INFO] Reactor Summary:
[INFO]
[INFO] tuxguitar-lib ...................................... SUCCESS [  5.522 s]
[INFO] tuxguitar-gm-utils ................................. SUCCESS [  0.128 s]
[INFO] tuxguitar-alsa ..................................... SUCCESS [  1.380 s]
[INFO] tuxguitar-editor-utils ............................. SUCCESS [  1.360 s]
[INFO] tuxguitar .......................................... SUCCESS [  3.457 s]
[INFO] tuxguitar-fluidsynth ............................... SUCCESS [  0.109 s]
[INFO] tuxguitar-jack ..................................... SUCCESS [  0.121 s]
[INFO] tuxguitar-jack-ui .................................. SUCCESS [  0.086 s]
[INFO] tuxguitar-oss ...................................... SUCCESS [  0.342 s]
[INFO] tuxguitar-tray ..................................... SUCCESS [  0.054 s]
[INFO] tuxguitar-awt-graphics ............................. SUCCESS [  0.062 s]
[INFO] tuxguitar-compat ................................... SUCCESS [  0.223 s]
[INFO] tuxguitar-viewer ................................... SUCCESS [  0.440 s]
[INFO] tuxguitar-ascii .................................... SUCCESS [  0.092 s]
[INFO] tuxguitar-browser-ftp .............................. SUCCESS [  0.123 s]
[INFO] tuxguitar-community ................................ SUCCESS [  0.536 s]
[INFO] tuxguitar-converter ................................ SUCCESS [  0.246 s]
[INFO] tuxguitar-gervill .................................. SUCCESS [  0.166 s]
[INFO] tuxguitar-gm-settings .............................. SUCCESS [  0.066 s]
[INFO] tuxguitar-gtp ...................................... SUCCESS [  0.221 s]
[INFO] tuxguitar-gtp-ui ................................... SUCCESS [  0.067 s]
[INFO] tuxguitar-gpx ...................................... SUCCESS [  0.109 s]
[INFO] tuxguitar-jsa ...................................... SUCCESS [  0.136 s]
[INFO] tuxguitar-lilypond ................................. SUCCESS [  0.118 s]
[INFO] tuxguitar-midi ..................................... SUCCESS [  0.145 s]
[INFO] tuxguitar-musicxml ................................. SUCCESS [  0.064 s]
[INFO] tuxguitar-ptb ...................................... SUCCESS [  0.141 s]
[INFO] tuxguitar-tef ...................................... SUCCESS [  0.154 s]
[INFO] tuxguitar-tuner .................................... SUCCESS [  0.124 s]
[INFO] tuxguitar-svg ...................................... SUCCESS [  0.134 s]
[INFO] tuxguitar-image .................................... SUCCESS [  0.079 s]
[INFO] tuxguitar-linux-x86 ................................ SUCCESS [ 23.078 s]
[INFO] ------------------------------------------------------------------------



regards
.g

--
java-devel mailing list
java-devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/java-devel

--
java-devel mailing list
java-devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/java-devel

[Index of Archives]     [Red Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux