You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@freemarker.apache.org by Christoph Rüger <c....@synesty.com> on 2016/07/27 22:08:42 UTC

Freemarker OSGI MANIFEST.MF

Hi,
I just started trying to be a Freemarker contributor for the first time
today :)
I got Eclipse setup and running I could work on a first idea regarding
error handling. Not much, just some debugging, making a change, see if it
compiles and has an effect. All fine so far.

In the freemarker.jar (2.3.25) from maven central there is a
META-INF/MANIFEST.MF with all the required OSGI Bundle headers. Seems that
this gets generated by bndtools. As I am not familiar with bndtools yet I
just hard-copied that folder (META-INF/MANIFEST.MF) manually into my
Eclipse freemarker project, so that our other OSGI bundles can see and
import this bundle as a dependency.
This works fine.

*My question(s): *
1. What would be a better way instead of copying the MANIFEST.MF from the
.jar file.
2. Anybody using freemarker in an OSGI context and also working with
freemarker source?

Thanks
Christoph

-- 
Synesty GmbH
Moritz-von-Rohr-Str. 1a
07745 Jena
Tel.: +49 3641 559649
Fax.: +49 3641 5596499
Internet: http://synesty.com

Geschäftsführer: Christoph Rüger
Unternehmenssitz: Jena
Handelsregister B beim Amtsgericht: Jena
Handelsregister-Nummer: HRB 508766
Ust-IdNr.: DE287564982

Re: Freemarker OSGI MANIFEST.MF

Posted by Christoph Rüger <c....@synesty.com>.
2016-07-29 20:18 GMT+02:00 Daniel Dekany <dd...@freemail.hu>:

> Friday, July 29, 2016, 5:06:49 PM, Christoph Rüger wrote:
>
> > I just asked a friend who is a Eclipse contributor and very familiar with
> > OSGI practises.
> > Here is a rough translation of his anwer:
> >
> > *bndtools takes the "generate Manifest" approach. *
> > *Eclipse on the other hand takes "Manifest first" approach. *
> > *You cannot mix the two, because Eclipse needs the manifest file,
> bndtools
> > doesn't. *
>
> Maintaining the OSGi manifest manually sounds quite impractical to me
> though, so it's only half of the story. The other half is certainly
> BundlerEclipse, though it won't be good for us anyway.
>
> > *One possible way could be to do the following in Eclipse:*
> > *Maybe create a separate ant-target which you add to the builders in
> > eclipse. This ant target could copy the generated MANIFEST.MF file into
> the
> > Eclipse Workspace project under META-INF/MANIFEST.MF instead of putting
> it
> > only in the jar file. *
>
> Sure, that's a possibility. Even right now, you expected to run `ant
> ide-dependencies`. That could be generalized to `ide-preparations` or
> somethingm which call ide-dependnecies and then also calls bnd to
> generates the metainf somewhere where Eclipse finds it but the Ant
> build ignores it. And then of course it has to be added to the
> gitignore.
>

Good idea.
I just tried that, adding the following to the ide-dependencies task:

<!-- Extract META-INF from freemarker.jar and put it in base directory for
eclipse -->
  <unzip src="build/freemarker.jar" dest=".">
   <patternset>
     <include name="META-INF/*"/>
   </patternset>
  </unzip>

And adding META-INF to .gitignore


> > I will try to investigate how I can modify the bnd ant-target so that the
> > MANIFEST.MF file is generated but not only in the JAR but also as a
> > separate file so that I do the copying.
>
> The important thing is that it must not affect the jar that Ant
> builds. That is, the metainfest generated by the Ant build must win.
>
> > If you have ideas or tips, let me know.
> >
> >
> > 2016-07-28 20:34 GMT+02:00 Daniel Dekany <dd...@freemail.hu>:
> >
> >> Ah, I see... and I don't know the answer. I have never developed
> >> FreeMarker itself while trying to depend on it via OSGi inside the
> >> IDE. Generating the OSGi manifest from a "template" (in this case with
> >> bnd) is quite normal though. Quick googling reveals that
> >> BundlorEclipse supports such a thing, but it works by regenerating the
> >> existing MAINFEST.MF (so it's not compatible with out current build),
> >> and also it uses Bundlor not Bnd.
> >>
> >>
> >> Thursday, July 28, 2016, 10:06:35 AM, Christoph Rüger wrote:
> >>
> >> > I expected the MANIFEST.MF as part of the freemarker source-code
> >> > which I have cloned/branched from github before.
> >> >
> >> > I realize I should get familiar with bnd / bndtools. I noticed the
> >> > .bnd file which creates the MANIFEST.MF file during the build.
> >> >
> >> > I need to find out how I can use bndtools in eclipse so that I have
> >> > a proper OSGI-Bundle at development time.
> >> > Because I need the META-INF/MANIFEST.MF in Eclipse at development
> >> > time so that other bundles in the same Eclipse Project recognize my
> >> Freemarker Workspace project.
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > 2016-07-28 8:54 GMT+02:00 Daniel Dekany <dd...@freemail.hu>:
> >> > The OSGi container should automatically use the MANIFEST.MF in the
> >> > jar. That's why it's there. Or how do you do this with other 3rd party
> >> > OSGi-ready jar-s?
> >> >
> >> >
> >> > Thursday, July 28, 2016, 12:08:42 AM, Christoph Rüger wrote:
> >> >
> >> >> Hi,
> >> >> I just started trying to be a Freemarker contributor for the first
> time
> >> >> today
> >> >> I got Eclipse setup and running I could work on a first idea
> regarding
> >> >> error handling. Not much, just some debugging, making a change, see
> if
> >> it
> >> >> compiles and has an effect. All fine so far.
> >> >>
> >> >> In the freemarker.jar (2.3.25) from maven central there is a
> >> >> META-INF/MANIFEST.MF with all the required OSGI Bundle headers. Seems
> >> that
> >> >> this gets generated by bndtools. As I am not familiar with bndtools
> yet
> >> I
> >> >> just hard-copied that folder (META-INF/MANIFEST.MF) manually into my
> >> >> Eclipse freemarker project, so that our other OSGI bundles can see
> and
> >> >> import this bundle as a dependency.
> >> >> This works fine.
> >> >>
> >> >> *My question(s): *
> >> >> 1. What would be a better way instead of copying the MANIFEST.MF from
> >> the
> >> >> .jar file.
> >> >> 2. Anybody using freemarker in an OSGI context and also working with
> >> >> freemarker source?
> >> >>
> >> >> Thanks
> >> >> Christoph
> >> >>
> >> >
> >> > --
> >> > Thanks,
> >> >  Daniel Dekany
> >> >
> >> >
> >> >
> >> >
> >>
> >> --
> >> Thanks,
> >>  Daniel Dekany
> >>
> >>
> >
> >
> > --
> > Christoph Rüger, Geschäftsführer
> > Synesty <https://synesty.com/> - Automatisierung, Schnittstellen,
> Datenfeeds
> > Tel.: +49 3641/559649
> >
> > Xing: https://www.xing.com/profile/Christoph_Rueger2
> > LinkedIn: http://www.linkedin.com/pub/christoph-rueger/a/685/198
> >
>
> --
> Thanks,
>  Daniel Dekany
>
>


-- 
Christoph Rüger, Geschäftsführer
Synesty <https://synesty.com/> - Automatisierung, Schnittstellen, Datenfeeds
Tel.: +49 3641/559649

Xing: https://www.xing.com/profile/Christoph_Rueger2
LinkedIn: http://www.linkedin.com/pub/christoph-rueger/a/685/198

-- 
Synesty GmbH
Moritz-von-Rohr-Str. 1a
07745 Jena
Tel.: +49 3641 559649
Fax.: +49 3641 5596499
Internet: http://synesty.com

Geschäftsführer: Christoph Rüger
Unternehmenssitz: Jena
Handelsregister B beim Amtsgericht: Jena
Handelsregister-Nummer: HRB 508766
Ust-IdNr.: DE287564982

Re: Freemarker OSGI MANIFEST.MF

Posted by Daniel Dekany <dd...@freemail.hu>.
Friday, July 29, 2016, 5:06:49 PM, Christoph R�ger wrote:

> I just asked a friend who is a Eclipse contributor and very familiar with
> OSGI practises.
> Here is a rough translation of his anwer:
>
> *bndtools takes the "generate Manifest" approach. *
> *Eclipse on the other hand takes "Manifest first" approach. *
> *You cannot mix the two, because Eclipse needs the manifest file, bndtools
> doesn't. *

Maintaining the OSGi manifest manually sounds quite impractical to me
though, so it's only half of the story. The other half is certainly
BundlerEclipse, though it won't be good for us anyway.

> *One possible way could be to do the following in Eclipse:*
> *Maybe create a separate ant-target which you add to the builders in
> eclipse. This ant target could copy the generated MANIFEST.MF file into the
> Eclipse Workspace project under META-INF/MANIFEST.MF instead of putting it
> only in the jar file. *

Sure, that's a possibility. Even right now, you expected to run `ant
ide-dependencies`. That could be generalized to `ide-preparations` or
somethingm which call ide-dependnecies and then also calls bnd to
generates the metainf somewhere where Eclipse finds it but the Ant
build ignores it. And then of course it has to be added to the
gitignore.

> I will try to investigate how I can modify the bnd ant-target so that the
> MANIFEST.MF file is generated but not only in the JAR but also as a
> separate file so that I do the copying.

The important thing is that it must not affect the jar that Ant
builds. That is, the metainfest generated by the Ant build must win.

> If you have ideas or tips, let me know.
>
>
> 2016-07-28 20:34 GMT+02:00 Daniel Dekany <dd...@freemail.hu>:
>
>> Ah, I see... and I don't know the answer. I have never developed
>> FreeMarker itself while trying to depend on it via OSGi inside the
>> IDE. Generating the OSGi manifest from a "template" (in this case with
>> bnd) is quite normal though. Quick googling reveals that
>> BundlorEclipse supports such a thing, but it works by regenerating the
>> existing MAINFEST.MF (so it's not compatible with out current build),
>> and also it uses Bundlor not Bnd.
>>
>>
>> Thursday, July 28, 2016, 10:06:35 AM, Christoph R�ger wrote:
>>
>> > I expected the MANIFEST.MF as part of the freemarker source-code
>> > which I have cloned/branched from github before.
>> >
>> > I realize I should get familiar with bnd / bndtools. I noticed the
>> > .bnd file which creates the MANIFEST.MF file during the build.
>> >
>> > I need to find out how I can use bndtools in eclipse so that I have
>> > a proper OSGI-Bundle at development time.
>> > Because I need the META-INF/MANIFEST.MF in Eclipse at development
>> > time so that other bundles in the same Eclipse Project recognize my
>> Freemarker Workspace project.
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > 2016-07-28 8:54 GMT+02:00 Daniel Dekany <dd...@freemail.hu>:
>> > The OSGi container should automatically use the MANIFEST.MF in the
>> > jar. That's why it's there. Or how do you do this with other 3rd party
>> > OSGi-ready jar-s?
>> >
>> >
>> > Thursday, July 28, 2016, 12:08:42 AM, Christoph R�ger wrote:
>> >
>> >> Hi,
>> >> I just started trying to be a Freemarker contributor for the first time
>> >> today
>> >> I got Eclipse setup and running I could work on a first idea regarding
>> >> error handling. Not much, just some debugging, making a change, see if
>> it
>> >> compiles and has an effect. All fine so far.
>> >>
>> >> In the freemarker.jar (2.3.25) from maven central there is a
>> >> META-INF/MANIFEST.MF with all the required OSGI Bundle headers. Seems
>> that
>> >> this gets generated by bndtools. As I am not familiar with bndtools yet
>> I
>> >> just hard-copied that folder (META-INF/MANIFEST.MF) manually into my
>> >> Eclipse freemarker project, so that our other OSGI bundles can see and
>> >> import this bundle as a dependency.
>> >> This works fine.
>> >>
>> >> *My question(s): *
>> >> 1. What would be a better way instead of copying the MANIFEST.MF from
>> the
>> >> .jar file.
>> >> 2. Anybody using freemarker in an OSGI context and also working with
>> >> freemarker source?
>> >>
>> >> Thanks
>> >> Christoph
>> >>
>> >
>> > --
>> > Thanks,
>> >  Daniel Dekany
>> >
>> >
>> >
>> >
>>
>> --
>> Thanks,
>>  Daniel Dekany
>>
>>
>
>
> -- 
> Christoph R�ger, Gesch�ftsf�hrer
> Synesty <https://synesty.com/> - Automatisierung, Schnittstellen, Datenfeeds
> Tel.: +49 3641/559649
>
> Xing: https://www.xing.com/profile/Christoph_Rueger2
> LinkedIn: http://www.linkedin.com/pub/christoph-rueger/a/685/198
>

-- 
Thanks,
 Daniel Dekany


Re: Freemarker OSGI MANIFEST.MF

Posted by Christoph Rüger <c....@synesty.com>.
I just asked a friend who is a Eclipse contributor and very familiar with
OSGI practises.
Here is a rough translation of his anwer:

*bndtools takes the "generate Manifest" approach. *
*Eclipse on the other hand takes "Manifest first" approach. *
*You cannot mix the two, because Eclipse needs the manifest file, bndtools
doesn't. *

*One possible way could be to do the following in Eclipse:*
*Maybe create a separate ant-target which you add to the builders in
eclipse. This ant target could copy the generated MANIFEST.MF file into the
Eclipse Workspace project under META-INF/MANIFEST.MF instead of putting it
only in the jar file. *

I will try to investigate how I can modify the bnd ant-target so that the
MANIFEST.MF file is generated but not only in the JAR but also as a
separate file so that I do the copying.
If you have ideas or tips, let me know.


2016-07-28 20:34 GMT+02:00 Daniel Dekany <dd...@freemail.hu>:

> Ah, I see... and I don't know the answer. I have never developed
> FreeMarker itself while trying to depend on it via OSGi inside the
> IDE. Generating the OSGi manifest from a "template" (in this case with
> bnd) is quite normal though. Quick googling reveals that
> BundlorEclipse supports such a thing, but it works by regenerating the
> existing MAINFEST.MF (so it's not compatible with out current build),
> and also it uses Bundlor not Bnd.
>
>
> Thursday, July 28, 2016, 10:06:35 AM, Christoph Rüger wrote:
>
> > I expected the MANIFEST.MF as part of the freemarker source-code
> > which I have cloned/branched from github before.
> >
> > I realize I should get familiar with bnd / bndtools. I noticed the
> > .bnd file which creates the MANIFEST.MF file during the build.
> >
> > I need to find out how I can use bndtools in eclipse so that I have
> > a proper OSGI-Bundle at development time.
> > Because I need the META-INF/MANIFEST.MF in Eclipse at development
> > time so that other bundles in the same Eclipse Project recognize my
> Freemarker Workspace project.
> >
> >
> >
> >
> >
> >
> >
> > 2016-07-28 8:54 GMT+02:00 Daniel Dekany <dd...@freemail.hu>:
> > The OSGi container should automatically use the MANIFEST.MF in the
> > jar. That's why it's there. Or how do you do this with other 3rd party
> > OSGi-ready jar-s?
> >
> >
> > Thursday, July 28, 2016, 12:08:42 AM, Christoph Rüger wrote:
> >
> >> Hi,
> >> I just started trying to be a Freemarker contributor for the first time
> >> today
> >> I got Eclipse setup and running I could work on a first idea regarding
> >> error handling. Not much, just some debugging, making a change, see if
> it
> >> compiles and has an effect. All fine so far.
> >>
> >> In the freemarker.jar (2.3.25) from maven central there is a
> >> META-INF/MANIFEST.MF with all the required OSGI Bundle headers. Seems
> that
> >> this gets generated by bndtools. As I am not familiar with bndtools yet
> I
> >> just hard-copied that folder (META-INF/MANIFEST.MF) manually into my
> >> Eclipse freemarker project, so that our other OSGI bundles can see and
> >> import this bundle as a dependency.
> >> This works fine.
> >>
> >> *My question(s): *
> >> 1. What would be a better way instead of copying the MANIFEST.MF from
> the
> >> .jar file.
> >> 2. Anybody using freemarker in an OSGI context and also working with
> >> freemarker source?
> >>
> >> Thanks
> >> Christoph
> >>
> >
> > --
> > Thanks,
> >  Daniel Dekany
> >
> >
> >
> >
>
> --
> Thanks,
>  Daniel Dekany
>
>


-- 
Christoph Rüger, Geschäftsführer
Synesty <https://synesty.com/> - Automatisierung, Schnittstellen, Datenfeeds
Tel.: +49 3641/559649

Xing: https://www.xing.com/profile/Christoph_Rueger2
LinkedIn: http://www.linkedin.com/pub/christoph-rueger/a/685/198

-- 
Synesty GmbH
Moritz-von-Rohr-Str. 1a
07745 Jena
Tel.: +49 3641 559649
Fax.: +49 3641 5596499
Internet: http://synesty.com

Geschäftsführer: Christoph Rüger
Unternehmenssitz: Jena
Handelsregister B beim Amtsgericht: Jena
Handelsregister-Nummer: HRB 508766
Ust-IdNr.: DE287564982

Re: Freemarker OSGI MANIFEST.MF

Posted by Daniel Dekany <dd...@freemail.hu>.
Ah, I see... and I don't know the answer. I have never developed
FreeMarker itself while trying to depend on it via OSGi inside the
IDE. Generating the OSGi manifest from a "template" (in this case with
bnd) is quite normal though. Quick googling reveals that
BundlorEclipse supports such a thing, but it works by regenerating the
existing MAINFEST.MF (so it's not compatible with out current build),
and also it uses Bundlor not Bnd.


Thursday, July 28, 2016, 10:06:35 AM, Christoph R�ger wrote:

> I expected the MANIFEST.MF as part of the freemarker source-code
> which I have cloned/branched from github before. 
>
> I realize I should get familiar with bnd / bndtools. I noticed the
> .bnd file which creates the MANIFEST.MF file during the build. 
>
> I need to find out how I can use bndtools in eclipse so that I have
> a proper OSGI-Bundle at development time. 
> Because I need the META-INF/MANIFEST.MF in Eclipse at development
> time so that other bundles in the same Eclipse Project recognize my Freemarker Workspace project.
>
>
>  
>
>  
>
>
> 2016-07-28 8:54 GMT+02:00 Daniel Dekany <dd...@freemail.hu>:
> The OSGi container should automatically use the MANIFEST.MF in the
> jar. That's why it's there. Or how do you do this with other 3rd party
> OSGi-ready jar-s?
>
>
> Thursday, July 28, 2016, 12:08:42 AM, Christoph R�ger wrote:
>
>> Hi,
>> I just started trying to be a Freemarker contributor for the first time
>> today  
>> I got Eclipse setup and running I could work on a first idea regarding
>> error handling. Not much, just some debugging, making a change, see if it
>> compiles and has an effect. All fine so far.
>>
>> In the freemarker.jar (2.3.25) from maven central there is a
>> META-INF/MANIFEST.MF with all the required OSGI Bundle headers. Seems that
>> this gets generated by bndtools. As I am not familiar with bndtools yet I
>> just hard-copied that folder (META-INF/MANIFEST.MF) manually into my
>> Eclipse freemarker project, so that our other OSGI bundles can see and
>> import this bundle as a dependency.
>> This works fine.
>>
>> *My question(s): *
>> 1. What would be a better way instead of copying the MANIFEST.MF from the
>> .jar file.
>> 2. Anybody using freemarker in an OSGI context and also working with
>> freemarker source?
>>
>> Thanks
>> Christoph
>>
>
> --
> Thanks,
>  Daniel Dekany
>
>
>
>

-- 
Thanks,
 Daniel Dekany


Re: Freemarker OSGI MANIFEST.MF

Posted by Christoph Rüger <c....@synesty.com>.
I expected the MANIFEST.MF as part of the freemarker source-code which I
have cloned/branched from github before.

I realize I should get familiar with bnd / bndtools. I noticed the .bnd
file which creates the MANIFEST.MF file during the build.

I need to find out how I can use bndtools in eclipse so that I have a
proper OSGI-Bundle at development time.
Because I need the META-INF/MANIFEST.MF in Eclipse at development time so
that other bundles in the same Eclipse Project recognize my Freemarker
Workspace project.







2016-07-28 8:54 GMT+02:00 Daniel Dekany <dd...@freemail.hu>:

> The OSGi container should automatically use the MANIFEST.MF in the
> jar. That's why it's there. Or how do you do this with other 3rd party
> OSGi-ready jar-s?
>
>
> Thursday, July 28, 2016, 12:08:42 AM, Christoph Rüger wrote:
>
> > Hi,
> > I just started trying to be a Freemarker contributor for the first time
> > today :)
> > I got Eclipse setup and running I could work on a first idea regarding
> > error handling. Not much, just some debugging, making a change, see if it
> > compiles and has an effect. All fine so far.
> >
> > In the freemarker.jar (2.3.25) from maven central there is a
> > META-INF/MANIFEST.MF with all the required OSGI Bundle headers. Seems
> that
> > this gets generated by bndtools. As I am not familiar with bndtools yet I
> > just hard-copied that folder (META-INF/MANIFEST.MF) manually into my
> > Eclipse freemarker project, so that our other OSGI bundles can see and
> > import this bundle as a dependency.
> > This works fine.
> >
> > *My question(s): *
> > 1. What would be a better way instead of copying the MANIFEST.MF from the
> > .jar file.
> > 2. Anybody using freemarker in an OSGI context and also working with
> > freemarker source?
> >
> > Thanks
> > Christoph
> >
>
> --
> Thanks,
>  Daniel Dekany
>
>


-- 
Christoph Rüger, Geschäftsführer
Synesty <https://synesty.com/> - Automatisierung, Schnittstellen, Datenfeeds
Tel.: +49 3641/559649

Xing: https://www.xing.com/profile/Christoph_Rueger2
LinkedIn: http://www.linkedin.com/pub/christoph-rueger/a/685/198

-- 
Synesty GmbH
Moritz-von-Rohr-Str. 1a
07745 Jena
Tel.: +49 3641 559649
Fax.: +49 3641 5596499
Internet: http://synesty.com

Geschäftsführer: Christoph Rüger
Unternehmenssitz: Jena
Handelsregister B beim Amtsgericht: Jena
Handelsregister-Nummer: HRB 508766
Ust-IdNr.: DE287564982

Re: Freemarker OSGI MANIFEST.MF

Posted by Daniel Dekany <dd...@freemail.hu>.
The OSGi container should automatically use the MANIFEST.MF in the
jar. That's why it's there. Or how do you do this with other 3rd party
OSGi-ready jar-s?


Thursday, July 28, 2016, 12:08:42 AM, Christoph R�ger wrote:

> Hi,
> I just started trying to be a Freemarker contributor for the first time
> today :)
> I got Eclipse setup and running I could work on a first idea regarding
> error handling. Not much, just some debugging, making a change, see if it
> compiles and has an effect. All fine so far.
>
> In the freemarker.jar (2.3.25) from maven central there is a
> META-INF/MANIFEST.MF with all the required OSGI Bundle headers. Seems that
> this gets generated by bndtools. As I am not familiar with bndtools yet I
> just hard-copied that folder (META-INF/MANIFEST.MF) manually into my
> Eclipse freemarker project, so that our other OSGI bundles can see and
> import this bundle as a dependency.
> This works fine.
>
> *My question(s): *
> 1. What would be a better way instead of copying the MANIFEST.MF from the
> .jar file.
> 2. Anybody using freemarker in an OSGI context and also working with
> freemarker source?
>
> Thanks
> Christoph
>

-- 
Thanks,
 Daniel Dekany