[fedora-java] building new tuxguitar with maven

Michael Šimáček msimacek at redhat.com
Mon Feb 1 22:15:54 UTC 2016


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_shell_scripts
>>>>
>>>
>>> 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
>


More information about the java-devel mailing list