FMPP SourceFile Classpath

6 messages Options
Embed this post
Permalink
Shelley, Ryan

FMPP SourceFile Classpath

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)

Is it possible to supply a classpath to the sources and inheritConfiguration directives within a FMPP configuration file?

 

Thanks!

 

-Ryan

 


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
fmpp-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fmpp-open
Daniel Dekany

Re: FMPP SourceFile Classpath

Reply Threaded More More options
Print post
Permalink
Wednesday, October 28, 2009, 1:01:26 AM, Shelley, Ryan wrote:

> Is it possible to supply a classpath to the sources and
> inheritConfiguration directives within a FMPP configuration file?

No, that's a Java concern. You have to set up the Java environment
*before* calling FMPP.

> Thanks!
>  
> -Ryan
>  

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
fmpp-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fmpp-open
Daniel Dekany

Re: FMPP SourceFile Classpath

Reply Threaded More More options
Print post
Permalink
Wednesday, October 28, 2009, 2:39:00 AM, Daniel Dekany wrote:

> Wednesday, October 28, 2009, 1:01:26 AM, Shelley, Ryan wrote:
>
>> Is it possible to supply a classpath to the sources and
>> inheritConfiguration directives within a FMPP configuration file?
>
> No, that's a Java concern. You have to set up the Java environment
> *before* calling FMPP.

Which is not at all trivial to do for those who are not wrestled in
Java... so, here is the recipe:

(a) Easy but dirty solution: Just drop the jar into $FMPP_HOME/lib,
and it will automatically see it, but only when you are using the
$FMPP_HOME/bin/fmpp shell script for running the FMPP projects. This
has global effect in the sense that all FMPP projects that are run
with $FMPP_HOME/bin/fmpp will see the extra jars added there.

(b) The clean solution: Create a "lib" sub-directory in your FMPP
*project* directory, and drop the extra jar into there. Then, in the
same directory you should create a bash script (or .bat, on Windows)
that runs FMPP with your own custom class-path:

  On Linux/UN*X:

    java -cp ./lib/yourExtra1.jar:./lib/yourExtra2.jar:$FMPP_HOME/lib/fmpp.jar fmpp.tools.CommandLine

  On Windows:

    java -cp .\lib\yourExtra1.jar;.\lib\yourExtra2.jar;%FMPP_HOME%\lib\fmpp.jar fmpp.tools.CommandLine

Note that the scrip assumes that the working directory is already your
project directory (you may need to "cd" into it as the first step in
the script). Also it assumes that you have an FMPP_HOME environment
variable; if you don't have it, not a problem, just replace it with a
concrete path in the above scripts (or better, define the environment
variable locally in the scrip).

Yeah, someday I should invest into writing a native launcher app. that
does all the Java setup magic automatically... /-:

>> Thanks!
>>  
>> -Ryan

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
fmpp-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fmpp-open
Daniel Dekany

Re: FMPP SourceFile Classpath

Reply Threaded More More options
Print post
Permalink
Wednesday, October 28, 2009, 3:43:41 PM, Daniel Dekany wrote:

> Wednesday, October 28, 2009, 2:39:00 AM, Daniel Dekany wrote:
>
>> Wednesday, October 28, 2009, 1:01:26 AM, Shelley, Ryan wrote:
>>
>>> Is it possible to supply a classpath to the sources and
>>> inheritConfiguration directives within a FMPP configuration file?
>>
>> No, that's a Java concern. You have to set up the Java environment
>> *before* calling FMPP.
>
> Which is not at all trivial to do for those who are not wrestled in
> Java... so, here is the recipe:
>
> (a) Easy but dirty solution: Just drop the jar into $FMPP_HOME/lib,
> and it will automatically see it, but only when you are using the
> $FMPP_HOME/bin/fmpp shell script for running the FMPP projects.
[snip]

Or, fmpp.bat. Same thing...

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
fmpp-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fmpp-open
Shelley, Ryan

Re: FMPP SourceFile Classpath

Reply Threaded More More options
Print post
Permalink
In reply to this post by Daniel Dekany
Well, what I really need is to be able to put my template and sources in
a JAR, and then in my .fmpp config files, reference them like:

sources: classpath:/in/my/classpath/source.properties
inheritConfiguration: classpath:/in/my/classpath/template.properties

or in the Ant Task, like:

<fmpp sourceFile="classpath:/in/my/classpath/template.properties"
data="classpath:/in/my/classpath/data.properties" />
    Or
<fmpp configuration="classpath:/in/my/classpath/foobar.fmpp"
data="classpath:/in/my/classpath/data.properties" />

Then I can bundle my sources and templates in a JAR that can be read
when that JAR is loaded on the classpath, then run my Maven Ant Tasks
and have those resources found without having to give explicit
filesystem paths.

Here's the scenario. I have two maven projects, one that builds a JAR
that contains resource files and some classes (say, an arbitrary Service
module), the second (say, a WAR Web App) depends on the first (the web
component uses the arbitrary Service module) and has a Maven Ant Run
FMPP task to generate some property files based upon the templates that
exist in the first project that configures the dependent Service for
that specific Web app.  At the moment, my FMPP Ant Task takes a
filesystem path to the configuration file or the filesystem path to the
source and data files.

Right now my Maven Ant Tasks, configuration files, etc all need
relative/absolute filesystem paths that may change between developer
environments (our source repo allows arbitrary folder mapping in
workspaces, so I can't guarantee another developer's project workspace
looks like mine).

If it's not currently supported, that's fine, just want make sure I'm
not missing some functionality that's built in.  And if not, maybe
(assuming I get some bandwidth), I could help contribute.  Thanks!

-Ryan

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Daniel
Dekany
Sent: Wednesday, October 28, 2009 7:44 AM
To: FMPP open discussion
Subject: Re: [FMPP] FMPP SourceFile Classpath

Wednesday, October 28, 2009, 2:39:00 AM, Daniel Dekany wrote:

> Wednesday, October 28, 2009, 1:01:26 AM, Shelley, Ryan wrote:
>
>> Is it possible to supply a classpath to the sources and
>> inheritConfiguration directives within a FMPP configuration file?
>
> No, that's a Java concern. You have to set up the Java environment
> *before* calling FMPP.

Which is not at all trivial to do for those who are not wrestled in
Java... so, here is the recipe:

(a) Easy but dirty solution: Just drop the jar into $FMPP_HOME/lib,
and it will automatically see it, but only when you are using the
$FMPP_HOME/bin/fmpp shell script for running the FMPP projects. This
has global effect in the sense that all FMPP projects that are run
with $FMPP_HOME/bin/fmpp will see the extra jars added there.

(b) The clean solution: Create a "lib" sub-directory in your FMPP
*project* directory, and drop the extra jar into there. Then, in the
same directory you should create a bash script (or .bat, on Windows)
that runs FMPP with your own custom class-path:

  On Linux/UN*X:

    java -cp
./lib/yourExtra1.jar:./lib/yourExtra2.jar:$FMPP_HOME/lib/fmpp.jar
fmpp.tools.CommandLine

  On Windows:

    java -cp
.\lib\yourExtra1.jar;.\lib\yourExtra2.jar;%FMPP_HOME%\lib\fmpp.jar
fmpp.tools.CommandLine

Note that the scrip assumes that the working directory is already your
project directory (you may need to "cd" into it as the first step in
the script). Also it assumes that you have an FMPP_HOME environment
variable; if you don't have it, not a problem, just replace it with a
concrete path in the above scripts (or better, define the environment
variable locally in the scrip).

Yeah, someday I should invest into writing a native launcher app. that
does all the Java setup magic automatically... /-:

>> Thanks!
>>  
>> -Ryan

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------
------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and
stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
fmpp-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fmpp-open

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
fmpp-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fmpp-open
Daniel Dekany

Re: FMPP SourceFile Classpath

Reply Threaded More More options
Print post
Permalink
Wednesday, October 28, 2009, 6:39:16 PM, Shelley, Ryan wrote:

> Well, what I really need is to be able to put my template and sources in
> a JAR, and then in my .fmpp config files, reference them like:
>
> sources: classpath:/in/my/classpath/source.properties
> inheritConfiguration: classpath:/in/my/classpath/template.properties

Aha. Unfortunately that won't work. FreeMarker itself has no problem
with classpath resources, but "by design" FMPP has, since it deals
with files directly, no VFS abstraction or like. This thing was
originally written to solve some dirty file preprocessing issues for
me, and that was the quick way... /-:

If it's really a big problem for you, you might consider using
FreeMarker directly. If you depend on many FMPP features, that could
be painful though.

> or in the Ant Task, like:
>
> <fmpp sourceFile="classpath:/in/my/classpath/template.properties"
> data="classpath:/in/my/classpath/data.properties" />
>     Or
> <fmpp configuration="classpath:/in/my/classpath/foobar.fmpp"
> data="classpath:/in/my/classpath/data.properties" />
>
> Then I can bundle my sources and templates in a JAR that can be read
> when that JAR is loaded on the classpath, then run my Maven Ant Tasks
> and have those resources found without having to give explicit
> filesystem paths.
>
> Here's the scenario. I have two maven projects, one that builds a JAR
> that contains resource files and some classes (say, an arbitrary Service
> module), the second (say, a WAR Web App) depends on the first (the web
> component uses the arbitrary Service module) and has a Maven Ant Run
> FMPP task to generate some property files based upon the templates that
> exist in the first project that configures the dependent Service for
> that specific Web app.  At the moment, my FMPP Ant Task takes a
> filesystem path to the configuration file or the filesystem path to the
> source and data files.
>
> Right now my Maven Ant Tasks, configuration files, etc all need
> relative/absolute filesystem paths that may change between developer
> environments (our source repo allows arbitrary folder mapping in
> workspaces, so I can't guarantee another developer's project workspace
> looks like mine).
>
> If it's not currently supported, that's fine, just want make sure I'm
> not missing some functionality that's built in.  And if not, maybe
> (assuming I get some bandwidth), I could help contribute.  Thanks!
>
> -Ryan
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Daniel
> Dekany
> Sent: Wednesday, October 28, 2009 7:44 AM
> To: FMPP open discussion
> Subject: Re: [FMPP] FMPP SourceFile Classpath
>
> Wednesday, October 28, 2009, 2:39:00 AM, Daniel Dekany wrote:
>
>> Wednesday, October 28, 2009, 1:01:26 AM, Shelley, Ryan wrote:
>>
>>> Is it possible to supply a classpath to the sources and
>>> inheritConfiguration directives within a FMPP configuration file?
>>
>> No, that's a Java concern. You have to set up the Java environment
>> *before* calling FMPP.
>
> Which is not at all trivial to do for those who are not wrestled in
> Java... so, here is the recipe:
>
> (a) Easy but dirty solution: Just drop the jar into $FMPP_HOME/lib,
> and it will automatically see it, but only when you are using the
> $FMPP_HOME/bin/fmpp shell script for running the FMPP projects. This
> has global effect in the sense that all FMPP projects that are run
> with $FMPP_HOME/bin/fmpp will see the extra jars added there.
>
> (b) The clean solution: Create a "lib" sub-directory in your FMPP
> *project* directory, and drop the extra jar into there. Then, in the
> same directory you should create a bash script (or .bat, on Windows)
> that runs FMPP with your own custom class-path:
>
>   On Linux/UN*X:
>
>     java -cp
> ./lib/yourExtra1.jar:./lib/yourExtra2.jar:$FMPP_HOME/lib/fmpp.jar
> fmpp.tools.CommandLine
>
>   On Windows:
>
>     java -cp
> .\lib\yourExtra1.jar;.\lib\yourExtra2.jar;%FMPP_HOME%\lib\fmpp.jar
> fmpp.tools.CommandLine
>
> Note that the scrip assumes that the working directory is already your
> project directory (you may need to "cd" into it as the first step in
> the script). Also it assumes that you have an FMPP_HOME environment
> variable; if you don't have it, not a problem, just replace it with a
> concrete path in the above scripts (or better, define the environment
> variable locally in the scrip).
>
> Yeah, someday I should invest into writing a native launcher app. that
> does all the Java setup magic automatically... /-:
>
>>> Thanks!
>>>  
>>> -Ryan
>

--
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
fmpp-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fmpp-open