Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netbeans 7: Why is my edited manifest not being included?

I have the following target in my build.xml:

<target name="-pre-compile">
    <property file="build.properties"/>
    <buildnumber file="build.version"/>
    <tstamp>
        <format property="timestamp" pattern="yyyy-MM-dd HH:mm:ss"/>
    </tstamp>
    <manifest file="manifest.mf">
        <attribute name="MAJOR" value="${version.major}"/>
        <attribute name="MINOR" value="${version.minor}"/>
        <attribute name="RELEASE" value="${release}"/>
        <attribute name="BUILD" value="${build.number}"/>
        <attribute name="BUILD-DATE" value="${timestamp}"/>
        <attribute name="PROTOCOL" value="${protocol}"/>
        <attribute name="APPCODE" value="${appcode}"/>
    </manifest>    
</target>

It works fine, opening manifest.mf after a Clean and Build within Netbeans shows all my extra attributes that I've added. However, when I open my jar file I see that it just contains the default stuff:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.2
Created-By: 1.7.0-b147 (Oracle Corporation)

I had this working fine before when I had two packages in one project. The one package was all library stuff that I'm gonna be taking to other projects, so I decided to split it out into another project so I could build the library jar by itself. Now I have this problem. It occurs both when I compile the library on its own as well as my other project that depends on it.

like image 784
ldam Avatar asked Mar 03 '13 18:03

ldam


3 Answers

I've fixed it by opening nbproject/project.properties and adding manifest.file=manifest.mf to the end. Simple as that.

like image 61
ldam Avatar answered Oct 12 '22 23:10

ldam


check this answer here: Is it possible to add a custom manifest to a Java library compiled in Netbeans 6.7.1?

I had your same problem, adding this at the end of my build.xml solved the issue:

<target name="-post-jar">
 <jar destfile="${dist.jar}" update="true">
    <manifest>
        <attribute name="Manifest-Version" value="1.0" />           
        <attribute name="Extension-Name" value="polpol" />
        <attribute name="Class-Manager" value="org.nlogo.extensions.polpol.Manager" />
        <attribute name="NetLogo-Extension-API-Version" value="5.0" />
    </manifest>
 </jar>
</target>
like image 43
user299791 Avatar answered Oct 13 '22 00:10

user299791


I happen to have encountered the same issues youre having here, and luckly enough have fixed it. Unfortunately I dont know what exactly caused the issue, and after comparing your code to mine, the only difference I see really is the name of the manifest file in your build.xml, and the event which triggers the task (I used pre init). I have all in capitals, and supplement the manifest version info with in the Version.txt file which is created in the dist directory -post-jar. You may just want to try to make

manifest file="manifest.mf"

read

manifest file="MANIFEST.MF"

Here is a copy of the important parts of my build.xml:

<property name="project.name" value="VOXManagement" /> 
    <property name="version.num" value="1.1" /> 
    <target name="-pre-init"> 
       <tstamp> 
          <format property="NOW" pattern="yyyy-MM-dd HH:mm:ss z" /> 
       </tstamp> 
       <manifest file="MANIFEST.MF"> 
          <attribute name="Bundle-Name" value="${project.name}" />            
          <attribute name="Bundle-Version" value="${version.num}" /> 
          <attribute name="Bundle-Date" value="${NOW}" /> 
          <!--<attribute name="Bundle-Revision" value="${svna.version}" />-->
          <attribute name="Implementation-Title" value="${project.name}" /> 
          <attribute name="Implementation-Version" value="${version.num}" /> 
       </manifest>  
       <echo file="Version.txt">V${version.num}</echo>     
    </target>
    <target name="-post-jar">
        <copy file="Version.txt" todir="dist" overwrite="true"/>    
        <delete file="dist/README.TXT"/>
    </target>
like image 35
Mark W Avatar answered Oct 13 '22 01:10

Mark W