2017. 6. 19. 11:33


1) build.xml에 다음의 내용을 추가해주세요. (myProject ==> jar명을 지정해주세요.)

 <target name="package-for-store" depends="jar">
    <property name="store.jar.name" value="myProject"/>
    <property name="store.dir" value="store"/>
    <property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/>
    <echo message="Packaging ${application.title} into a single JAR at ${store.jar}"/>
    <delete dir="${store.dir}"/>
    <mkdir dir="${store.dir}"/>
    <jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip">
        <zipgroupfileset dir="dist" includes="*.jar"/>
        <zipgroupfileset dir="dist/lib" includes="*.jar"/>
        <manifest>
            <attribute name="Main-Class" value="${main.class}"/>
        </manifest>
    </jar>
    <zip destfile="${store.jar}">
        <zipfileset src="${store.dir}/temp_final.jar"
        excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/>
    </zip>
    <delete file="${store.dir}/temp_final.jar"/>
</target>

2) build.xml을 저장하시고 마우스 오른쪽 버튼을 클릭하셔서 Run Target > Other Targets > package-for-store를 선택하세요.

3) store폴더에 지정된 jar명으로 생성이 되었는지 확인.


https://stackoverflow.com/questions/18451052/how-to-include-jars-in-lib-into-project-jar-file-in-netbeans


Posted by 모바일헌터