Different values of environment variables during build time and run time, eg. JAVA_HOME and PATH

Sergio Schvezov sergio.schvezov at canonical.com
Tue Oct 11 10:23:11 UTC 2016

El martes, 11 de octubre de 2016 06h'38:49 ART, Jian LUO 
<jian.luo.cn at gmail.com> escribió:
> Hi,
> Thanks for the explanation. That's exactly what comes first in my mind.
> I've tried to customize the ant / jdk plugin by overriding the env method.
> The doc string of BasePlugin.env reads "return a list with the execution
> environment for building". However the result env applies both to build
> time and to the generated wrapper nonetheless. How can i override runtime
> only env in the plugin?

Look at how we do it in the go plugin. That will give you anice idea.

With regards to a way to do it more generically we want to eventually 
introduce a build-environment keyword for parts and have that carry some 
weight in the chaining of parts with the `after` keyword. As an 
illustration you would be able to do something like this:

        source: <path to source>
        after: [ibm-java]
            - CLASSPATH:....
            - $ibm-java
        plugin: dump
        source: <path to IBM java sources>
            - JAVA_HOME: ....
            - PATH:....
            - PATH:....

And for apps:

        command: <command>
            - $ibm-java

Something like that. This in the design phase though. But this way you can 
provide a Java to build as a part and a subsequent one to use as the 

Enviado con Dekko desde mi dispositivo Ubuntu

More information about the Snapcraft mailing list