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
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.
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/tuxguitar/. Is there a way to tell maven to install the jar files there instead (these are application jars, not shared libraries) ?
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?
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?
My current work is at https://oget.fedorapeople.org/tuxguitar/tuxguitar.spec https://oget.fedorapeople.org/tuxguitar/tuxguitar-1.3.0-0.fc23.src.rpm
Note that I had to remove some SF2, EXE and DLL files from the source tarball, as their license situations were unclear.
I would be happy if someone knowledgeable with maven could take a look and give me some clues.
Best, Orcan
[1] https://fedorahosted.org/released/javapackages/doc/#maven
On Sat, Jan 23, 2016 at 9:16 PM Orcan Ogetbil oget.fedora@gmail.com 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
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/tuxguitar/. 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}
Il 24/01/2016 05:03, Christopher ha scritto:
On Sat, Jan 23, 2016 at 9:16 PM Orcan Ogetbil <oget.fedora@gmail.com mailto:oget.fedora@gmail.com> 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@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/java-devel
On 24 January 2016 at 06:17, gil wrote:
Il 24/01/2016 05:03, Christopher ha scritto: On Sat, Jan 23, 2016 at 9:16 PM Orcan Ogetbil wrote:
-- snip --
Thank you Chris, gil. Your answers really very helpful.
I used gil's snippets as a starting point, which after a few tweaks took me almost to the finishing line (I still have to write a build script for the armv7hl architecture but this should be straightforward)
There are a few questions issues remaining:
- Following gil's method, the tuxguitar-alsa.jar tuxguitar-jack.jar, tuxguitar-fluidsynth.jar, tuxguitar-oss.jar files get built but they do not get installed. I have to copy them manually to buildroot, and add entries into %files since the .mfiles doesn't include them either.
- Do I really have to add all these jars to the CLASSPATH in the launching script? Why did I not have to do this with ant?
- With ant, I was able to install the extra files (.desktop, icons etc) to the proper locations with just the ant invocation. Is maven not capable of doing this?
Thanks again, Orcan
On 2016-01-24 03:15, Orcan Ogetbil 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
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.
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/tuxguitar/. Is there a way to tell maven to install the jar files there instead (these are application jars, not shared libraries) ?
There is, but since the launcher script doesn't do much more than finding system Java, I would suggest not using upstream launcher script, but generating your own with %jpackage_script, which should look for stuff in the right directories. See: https://fedorahosted.org/released/javapackages/doc/#_generating_application_...
In case you still think you need the jar files in /usr/share/tuxguitar, you should still install them to /usr/share/java and put a symlink into /usr/share/tuxguitar. This should do the trick: %mvn_file ':{*}' %{name}/@1 /usr/share/%{name}/@1 (It uses a glob pattern so you don't need to do it for each artifact in a for loop. ':{*}' is a pattern that captures artifact ID, which can be then referenced in file paths in with @1)
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?
As with the previous item, I'd suggest generating the launcher script with %jpackage_script. There you can just specify "tuxguitar" in the classpath argument and it should find the jars.
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?
I think those need to be installed manually. (but script generated with %jpackage_script should install itself automatically)
My current work is at https://oget.fedorapeople.org/tuxguitar/tuxguitar.spec https://oget.fedorapeople.org/tuxguitar/tuxguitar-1.3.0-0.fc23.src.rpm
Note that I had to remove some SF2, EXE and DLL files from the source tarball, as their license situations were unclear.
I would be happy if someone knowledgeable with maven could take a look and give me some clues.
Best, Orcan
[1] https://fedorahosted.org/released/javapackages/doc/#maven
java-devel mailing list java-devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/java-devel
On 25 January 2016 at 03:40, Michael Šimáček wrote:
On 2016-01-24 03:15, Orcan Ogetbil wrote:
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/tuxguitar/. Is there a way to tell maven to install the jar files there instead (these are application jars, not shared libraries) ?
There is, but since the launcher script doesn't do much more than finding system Java, I would suggest not using upstream launcher script, but generating your own with %jpackage_script, which should look for stuff in the right directories. See: https://fedorahosted.org/released/javapackages/doc/#_generating_application_...
Great. I can certainly give that a shot. How do I tell %jpackage_script that I want to pass some additional flags to java, such as -Xmx512m ?
In case you still think you need the jar files in /usr/share/tuxguitar
No not really. It was the way we did in tuxguitar-1.2 but I am fine either way as long as the application launches (and it does when I set the full CLASSPATH to /usr/share/java/tuxguitar/)
Best, Orcan
On 25 January 2016 at 03:40, Michael Šimáček msimacek@redhat.com wrote:
On 2016-01-24 03:15, Orcan Ogetbil 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
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.
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/tuxguitar/. Is there a way to tell maven to install the jar files there instead (these are application jars, not shared libraries) ?
There is, but since the launcher script doesn't do much more than finding system Java, I would suggest not using upstream launcher script, but generating your own with %jpackage_script, which should look for stuff in the right directories. See: https://fedorahosted.org/released/javapackages/doc/#_generating_application_...
In case you still think you need the jar files in /usr/share/tuxguitar, you should still install them to /usr/share/java and put a symlink into /usr/share/tuxguitar. This should do the trick: %mvn_file ':{*}' %{name}/@1 /usr/share/%{name}/@1 (It uses a glob pattern so you don't need to do it for each artifact in a for loop. ':{*}' is a pattern that captures artifact ID, which can be then referenced in file paths in with @1)
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?
As with the previous item, I'd suggest generating the launcher script with %jpackage_script. There you can just specify "tuxguitar" in the classpath argument and it should find the jars.
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?
I think those need to be installed manually. (but script generated with %jpackage_script should install itself automatically)
My current work is at https://oget.fedorapeople.org/tuxguitar/tuxguitar.spec https://oget.fedorapeople.org/tuxguitar/tuxguitar-1.3.0-0.fc23.src.rpm
Note that I had to remove some SF2, EXE and DLL files from the source tarball, as their license situations were unclear.
I would be happy if someone knowledgeable with maven could take a look and give me some clues.
Best, Orcan
[1] https://fedorahosted.org/released/javapackages/doc/#maven
java-devel mailing list java-devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/java-devel
On 2016-01-25 10:08, Orcan Ogetbil wrote:
On 25 January 2016 at 03:40, Michael Šimáček wrote:
On 2016-01-24 03:15, Orcan Ogetbil wrote:
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/tuxguitar/. Is there a way to tell maven to install the jar files there instead (these are application jars, not shared libraries) ?
There is, but since the launcher script doesn't do much more than finding system Java, I would suggest not using upstream launcher script, but generating your own with %jpackage_script, which should look for stuff in the right directories. See: https://fedorahosted.org/released/javapackages/doc/#_generating_application_...
Great. I can certainly give that a shot. How do I tell %jpackage_script that I want to pass some additional flags to java, such as -Xmx512m ?
The second argument of %jpackage_script should be flags for JVM.
In case you still think you need the jar files in /usr/share/tuxguitar
No not really. It was the way we did in tuxguitar-1.2 but I am fine either way as long as the application launches (and it does when I set the full CLASSPATH to /usr/share/java/tuxguitar/)
Best, Orcan
On 25 January 2016 at 03:40, Michael Šimáček msimacek@redhat.com wrote:
On 2016-01-24 03:15, Orcan Ogetbil 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
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.
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/tuxguitar/. Is there a way to tell maven to install the jar files there instead (these are application jars, not shared libraries) ?
There is, but since the launcher script doesn't do much more than finding system Java, I would suggest not using upstream launcher script, but generating your own with %jpackage_script, which should look for stuff in the right directories. See: https://fedorahosted.org/released/javapackages/doc/#_generating_application_...
In case you still think you need the jar files in /usr/share/tuxguitar, you should still install them to /usr/share/java and put a symlink into /usr/share/tuxguitar. This should do the trick: %mvn_file ':{*}' %{name}/@1 /usr/share/%{name}/@1 (It uses a glob pattern so you don't need to do it for each artifact in a for loop. ':{*}' is a pattern that captures artifact ID, which can be then referenced in file paths in with @1)
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?
As with the previous item, I'd suggest generating the launcher script with %jpackage_script. There you can just specify "tuxguitar" in the classpath argument and it should find the jars.
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?
I think those need to be installed manually. (but script generated with %jpackage_script should install itself automatically)
My current work is at https://oget.fedorapeople.org/tuxguitar/tuxguitar.spec https://oget.fedorapeople.org/tuxguitar/tuxguitar-1.3.0-0.fc23.src.rpm
Note that I had to remove some SF2, EXE and DLL files from the source tarball, as their license situations were unclear.
I would be happy if someone knowledgeable with maven could take a look and give me some clues.
Best, Orcan
[1] https://fedorahosted.org/released/javapackages/doc/#maven
java-devel mailing list java-devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/java-devel
On 25 January 2016 at 04:13, Michael Šimáček wrote:
On 2016-01-25 10:08, Orcan Ogetbil wrote:
On 25 January 2016 at 03:40, Michael Šimáček wrote:
On 2016-01-24 03:15, Orcan Ogetbil wrote:
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/tuxguitar/. Is there a way to tell maven to install the jar files there instead (these are application jars, not shared libraries) ?
There is, but since the launcher script doesn't do much more than finding system Java, I would suggest not using upstream launcher script, but generating your own with %jpackage_script, which should look for stuff in the right directories. See:
https://fedorahosted.org/released/javapackages/doc/#_generating_application_...
Great. I can certainly give that a shot. How do I tell %jpackage_script that I want to pass some additional flags to java, such as -Xmx512m ?
The second argument of %jpackage_script should be flags for JVM.
Thanks, the documentation for the %jpackage_utils seems quite minimal :) I tried various combinations, such as
%jpackage_script org.herac.tuxguitar.app.TGMain "-Xmx512m" "" swt:tuxguitar tuxguitar true %jpackage_script org.herac.tuxguitar.app.TGMain "-Xmx512m" "" tuxguitar tuxguitar true or plain simple %jpackage_script org.herac.tuxguitar.app.TGMain "" "" tuxguitar tuxguitar true
They all fail with Exception in thread "main" java.lang.NoSuchMethodError: org.herac.tuxguitar.app.TuxGuitar.getInstance()Lorg/herac/tuxguitar/app/TuxGuitar; at org.herac.tuxguitar.app.TGMain.main(TGMain.java:13)
The entry point is correct. The original launcher script uses it, and I verified that there is a TGMain class with a 'public static void main(String[] args)' member. What could be wrong?
Other than this, the original script loads the default .tg file if no argument is given to the launcher, i.e.
local arg="" [ -z "$1" ] && arg="/usr/share/tuxguitar/tuxguitar.tg" ... ${JAVA} ${JAVA_FLAGS} ${PACKAGE_MAIN} $arg "$@"
Can we achieve the same with %jpackage_script?
Orcan
On 2016-01-26 05:37, Orcan Ogetbil wrote:
On 25 January 2016 at 04:13, Michael Šimáček wrote:
On 2016-01-25 10:08, Orcan Ogetbil wrote:
On 25 January 2016 at 03:40, Michael Šimáček wrote:
On 2016-01-24 03:15, Orcan Ogetbil wrote:
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/tuxguitar/. Is there a way to tell maven to install the jar files there instead (these are application jars, not shared libraries) ?
There is, but since the launcher script doesn't do much more than finding system Java, I would suggest not using upstream launcher script, but generating your own with %jpackage_script, which should look for stuff in the right directories. See:
https://fedorahosted.org/released/javapackages/doc/#_generating_application_...
Great. I can certainly give that a shot. How do I tell %jpackage_script that I want to pass some additional flags to java, such as -Xmx512m ?
The second argument of %jpackage_script should be flags for JVM.
Thanks, the documentation for the %jpackage_utils seems quite minimal :) I tried various combinations, such as
%jpackage_script org.herac.tuxguitar.app.TGMain "-Xmx512m" ""
swt:tuxguitar tuxguitar true %jpackage_script org.herac.tuxguitar.app.TGMain "-Xmx512m" "" tuxguitar tuxguitar true or plain simple %jpackage_script org.herac.tuxguitar.app.TGMain "" "" tuxguitar tuxguitar true
They all fail with Exception in thread "main" java.lang.NoSuchMethodError: org.herac.tuxguitar.app.TuxGuitar.getInstance()Lorg/herac/tuxguitar/app/TuxGuitar; at org.herac.tuxguitar.app.TGMain.main(TGMain.java:13)
The entry point is correct. The original launcher script uses it, and I verified that there is a TGMain class with a 'public static void main(String[] args)' member. What could be wrong?
I think this is because your package contains multiple classes named org.herac.app.TuxGuitar and incorrect one is being loaded. It seems that the plugins should be installed into a subdirectory, you can try doing that with: %mvn_file ':{tuxguitar-*}' %{name}/plugins/@1
Other than this, the original script loads the default .tg file if no argument is given to the launcher, i.e.
local arg="" [ -z "$1" ] && arg="/usr/share/tuxguitar/tuxguitar.tg" ... ${JAVA} ${JAVA_FLAGS} ${PACKAGE_MAIN} $arg "$@"
Can we achieve the same with %jpackage_script?
I'm afraid not. You can patch the generated script. Something like this (untested): sed -i 's#^run .*#run "${@:-/usr/share/tuxguitar/tuxguitar.tg}"#' %{buildroot}%{_bindir}/%{name}
Orcan
java-devel@lists.fedoraproject.org