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

Re: Resources folder is not installed in JAR file



> I can help fix this in your package if you want me to.

Oh yes !!! 10 000 yes :).
I used to program in C. Java is new to me, so I appreciate your help !


De: "Felix Natter" <fnatter@gmx.net>
À: "Cyril Richard" <Cyril.Richard@u-bourgogne.fr>
Cc: "debian-java" <debian-java@lists.debian.org>
Envoyé: Lundi 30 Septembre 2019 16:44:22
Objet: Re: Resources folder is not installed in JAR file

Cyril Richard <Cyril.Richard@u-bourgogne.fr> writes:

> Hello,

hi Cyril,

> After some difficulties, I think I'm almost done with my deb packaging of my java application [1].
> Now, the last thing I did not mannage to do is to install all my resource folder in the JAR file.
>
> My project tree looks like that:
>
> test
> resources
> sources
>
> I would like to include the directory resources inside my JAR file, like I created the JAR with eclipse.
> To do that, I tried several ways in the d/rules file.
>
> Currently, the file is like that (not in the repo, on my laptop):
>
> #!/usr/bin/make -f
> # debian/rules for spview
>
> %:
>     dh $@ --with javahelper
>
> override_jh_build:
>     jh_build --javacopts="-source 1.8 -target 1.8" --no-javadoc spview.jar sources
>
> I tried to add
> export JH_JAR_EXTRA=resources
> at the beginning of the file
>
> I also tried to write:
> override_jh_build:
>     jh_build --javacopts="-source 1.8 -target 1.8" --no-javadoc spview.jar sources resources
>
> or
>
>     dh $@ --with javahelper --sourcedirectory=resources
>
> with also no succes.

man jh_build does not mention resources:

jh_build [debhelper options] jarfile source [... source]

so it is still not supported, see #700196.

There is a workaround by adding the resources manually using jar uf
("update file") [1]:

override_dh_install:
  (cd <resourcedir> && jar uf .../foo.jar <resourcesubdir1> <resourcesubdir2> ...)
        dh_install

like this [2] (which could be refactored):

override_dh_install:
        # hack to get all files into the jar (jh_build can only include *.class)
        (cd src/main/resources                    && jar uf ../../../jsyntaxpane.jar META-INF)
        (cd src/main/resources/META-INF/services/ && jar uf ../../../../../jsyntaxpane.jar `find -name "config.properties"`)
        (cd src/main/resources/                   && jar uf ../../../jsyntaxpane.jar       `find -name "Bundle*properties"`)
        dh_install

[1] https://docs.oracle.com/javase/tutorial/deployment/jar/update.html
[2] https://salsa.debian.org/java-team/libjsyntaxpane-java/blob/master/debian/rules

I can help fix this in your package if you want me to.

Cheers and Best Regards,
--
Felix Natter
debian/rules!

Reply to: