help with ant and copy plugins for Java application
Sergio Schvezov
sergio.schvezov at canonical.com
Tue Jun 14 12:33:38 UTC 2016
El martes, 14 de junio de 2016 08h'15:48 ART, Jenny Murphy
<jenny.murphy at episensor.com> escribió:
> Hi,
> I am trying to build up some competency with snapcraft for java
> applications.
>
> Currently I have a hello world project which is based on
> https://github.com/ubuntu-core/snapcraft/blob/1.x/examples/java-hello-world/snapcraft.yaml
> .
>
> I have extended in that HelloWorld.java references a method from another
> package in an external jar file (HellowWorld-helper.jar)
>
> I edited the snapcraft.yaml to use the copy plugin to copy the jar file to
> the jar directory.
> It can be seen there after the snap stage.
>
> However in bin.wrapper.wrapper , the external jar file is not added to the
> classpath. So the application fails on running.
>
> How do I fix this?
First of all, thank you for giving this a try. I'll start with a couple of
details and follow on with a solution.
First of all, `bin.wrapper.bin` is an implementation detail, likely to go
away when we implement allowing `apps` (and `plugins`) to define
environment variables (https://pad.lv/1583259) which would do the right
thing on a snappy system. How would this look like in the not so distant
future:
...
apps:
bin:
command: ....
environment:
CLASSPATH: $CLASSPATH:$SNAP/path_to_jar/jar.jar
parts:
...
Now on to your problem. The java related plugins have logic to export
environment variables, but each part (driven by a plugin), is a private
world of its own. Since you used the copy plugin, the logic in the copy
plugin is just to copy. How do we solve in the immediate future? Well you
would need to create something similar to that wrapper and export the
required CLASSPATH.
I'll cut off here to not go into to much details, but I am happy to follow
up on this.
Cheers
Sergio
--
Enviado con Dekko desde mi dispositivo Ubuntu
More information about the Snapcraft
mailing list