[fedora-java] building new tuxguitar with maven

Michael Šimáček msimacek at redhat.com
Mon Jan 25 08:40:52 UTC 2016


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_shell_scripts

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 at lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/java-devel
>


More information about the java-devel mailing list