Hello,

I had the simple task of creating a MANIFEST file for a jar archive.
I Started with the echo task, but the result looked ugly in the ant script.
(Because a starting empty line as well as leading blanks had to be avoided.)

Then I had the idea to create a properties file and transform it into a manifest file.
Then all the problems started (and btw: Why didn't sun let the manifest file be a 
properties file? But o.k., this is offtopic here.)

Problem 1:
The propertyfile task always writes a starting comment. Why can't this be switched off?
The manifest file doesnt accept a starting comment line (nor an starting empty line).

Problem 2:
The replace task can't skip a line, only transform it. (O.k., this is the nature
of the replace. I rate it clean.)

Problem 3:
The filterchain can NOT have a nested replace. Why not? This is, what I rate really
unclean.

Problem 4:
The filterchain can have a nested replaceTokens, but this one can not simulate
a replace task, BECAUSE the begintoken and endtoken parameter may not be empty.
Why not? I can't see a good reason.

After all I ended with this ant script snipplet below, what looks far too complicate 
to me. 

              <propertyfile file="${projX_projects}/META-INF/MANIFEST.MF_">
                 <entry key="Manifest-Version" value="1.0" />
                 <entry key="Core-Date" type="date" value="now" pattern="dd.MM.yyyy 
HH:mm" />
                 <entry key="Main-Class" value="projX/ProjXMain" />
            </propertyfile>
            
            <copy   file="${projX_projects}/META-INF/MANIFEST.MF_"
                  tofile="${projX_projects}/META-INF/MANIFEST.MF"
                  overwrite="true">
               <filterchain>
                  <striplinecomments><comment value="#"/></striplinecomments> 
               </filterchain>
            </copy>      
                  
              <replace file="${projX_projects}/META-INF/MANIFEST.MF"
                 token="="
                 value=": "
              />
              <replace file="${projX_projects}/META-INF/MANIFEST.MF"
                 token="\:"
                 value=":"
              />
              
Is there an easier, better looking way to do this? 

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to