You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2008/05/01 16:18:44 UTC

DO NOT REPLY [Bug 44915] New: manifestclasspath interferes with other build targets when the classpath directory does not exist

https://issues.apache.org/bugzilla/show_bug.cgi?id=44915

           Summary: manifestclasspath interferes with other build targets
                    when the classpath directory does not exist
           Product: Ant
           Version: 1.7.0
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Build Process
        AssignedTo: notifications@ant.apache.org
        ReportedBy: david.green@morganstanley.com


I have a 'clean' target which deletes my build/lib and dist directories.

I encountered a build error after build/lib was created and when I re-ran ant I
get a error "48: Jar's directory not found".  Line 48 is the manifestclasspath
piece.

Re-running with 'ant clean' gets same error, even though 'clean' never attempts
to create the jar and hence should never need to look to the manifestclasspath.

Removing manifestclasspath, rebuilding, adding manifestclasspath and rebuilding
is the workaround I am using.

Incidentally if you put a full dependency (e.g. ant 'all') for
clean,copystatic,compile,jar,install there is NO error encountered so full
successful builds aren't affected by this issue.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 44915] manifestclasspath interferes with other build targets when the classpath directory does not exist

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44915


Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




--- Comment #5 from Stefan Bodewig <bo...@apache.org>  2008-09-26 03:04:52 PST ---
does it fail if manifestclasspath is inside a target?


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 44915] manifestclasspath interferes with other build targets when the classpath directory does not exist

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44915


Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|                            |WORKSFORME




--- Comment #6 from Stefan Bodewig <bo...@apache.org>  2008-11-17 08:12:17 PST ---
please reopen when more information is available


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 44915] manifestclasspath interferes with other build targets when the classpath directory does not exist

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44915





--- Comment #1 from Peter Reilly <pe...@apache.org>  2008-05-01 07:29:08 PST ---
There is not enough information here to debug your build file. 

Please try to make the smallest build file that shows the
issue and add it as an attachment to the bug report.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 44915] manifestclasspath interferes with other build targets when the classpath directory does not exist

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44915





--- Comment #2 from David <da...@morganstanley.com>  2008-05-01 08:14:26 PST ---
<project name="SomeApplication" default="all">

    <!-- PROJECT BASE / MAIN CLASS -->
    <property name="basedir" value="." />
    <property name="main.class" value="com.anyapps.start.${ant.project.name}"
/>

    <!-- BUILD DIRECTORIES -->
    <property name="source.dir" value="${basedir}/src" />
    <property name="build.dir" value="${basedir}/build" />
    <property name="classes.dir" value="${build.dir}/classes" />
    <property name="jar.dir" value="${build.dir}/jar" />
    <property name="jar.lib.dir" value="${jar.dir}/lib" />

    <!-- DIST DIRECTORIES (see install target) -->
    <property name="dist.dir" value="${basedir}/dist" />
    <property name="lib.dir" value="${dist.dir}/lib" />

    <target name="clean">
        <delete dir="${build.dir}" />
        <mkdir dir="${build.dir" />
        <mkdir dir="${classes.dir}" />
    </target>

    <target name="copylib" depends="clean">
        <delete dir="${dist.dir}" />
        <mkdir dir="${dist.dir}" />
        <mkdir dir="${jar.dir}" />
        <mkdir dir="${jar.lib.dir}" />
        <copy todir="${jar.lib.dir}" overwrite="true"> <!-- Copy
Spring/Hibernate/JDBC libraries etc. -->
            <fileset dir="${basedir}/lib" />
        </copy>
        <mkdir dir="${lib.dir}" />
        <copy todir="${lib.dir}" overwrite="true">
            <fileset dir="${basedir}/lib" />
        </copy>
    </target>

        <path id="build.classpath">
                <fileset dir="${jar.lib.dir}" includes="*.jar" />
        </path>

    <target name="compile">
        <javac srcdir="${source.dir}" destdir="${classes.dir}"
classpathref="build.classpath" />
    </target>

    <manifestclasspath property="jar.classpath"
jarfile="${jar.dir}/classpathjar.jar">
        <classpath refid="build.classpath" />
    </manifestclasspath>

    <target name="jar" depends="compile">
        <copy todir="${classes.dir}"> <!-- Copy Hibernate, log4J config files
etc. -->
            <fileset dir="${source.dir}" exclude="**/*.java" />
        </copy>
        <jar destfile="${jar.dir}/${ant.project.name}.jar"
basedir="${classes.dir}" index="no">
            <manifest>
                <attribute name="Main-Class" value="${main.class}" />
                <attribute name="Created-By" value="DG" />
                <attribute name="Class-Path" value="${jar-classpath}" />
            </manifest>
        </jar>
    </target>

    <target name="install">
        <copy file="${jar.dir}/${ant.project.name}.jar" todir="${dist.dir}" />
    </target>

    <target name="all" depends="copylib, jar, install" />

</project>


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 44915] manifestclasspath interferes with other build targets when the classpath directory does not exist

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44915


David <da...@morganstanley.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |david.green@morganstanley.co
                   |                            |m




-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 44915] manifestclasspath interferes with other build targets when the classpath directory does not exist

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44915





--- Comment #4 from Peter Reilly <pe...@apache.org>  2008-05-01 08:25:22 PST ---
Thanks,
the build file contains a <manifestclasspath> task
outside a <target>, this means that it gets
run before any target.

The manifestclasspath task will fail if
there is no directory for the task.

move the manifestclasspath task to
the line before the <jar>, or any
time after the classpath dir is made
(for example after the <mkdir> task
in the "copylib".

I notice that the "compile" target
does not depend on the "copylib" target.
It is good practice to declare all the target
dependencies.
Peter


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 44915] manifestclasspath interferes with other build targets when the classpath directory does not exist

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44915





--- Comment #3 from David <da...@morganstanley.com>  2008-05-01 08:21:52 PST ---
Incidentally if I specified index="true" when building the jar the classpath in
the classpath specified in teh manifest is NOT searched.

I think this could trip a lot of people up.  Recommend a warning in the build
output that manifestclasspath and index="true" cancel each other out.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.