Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-1097

"Copy Dependent Libraries" does not work if "Source/Binary Format" is greater than JDK 8

VotersWatch issueWatchersLinkUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      Steps to reproduce:

      1. File -> New Project -> Java Application -> Next -> Finish
      2. Right-click Libraries, Add JAR/Folder. Add whatever jar file.
      3. Check that project Properties -> Packaging -> Copy Dependent Libraries is checked.
      4. Clean and Build project.
      5. Observe contents of dist\ directory.

      When Project -> Properties -> Source/Binary Format is JDK 8, there exists dist\lib\ directory, and the jar added in step 1) is copied into that directory, as expected, when Copy Dependent Libraries is checked.

      But when Source/Binary Format is greater than JDK 8, dist\lib\ directory does not exist.

      The reason seems to be these parts in build-impl.xml:

      <target name="-init-modules-supported">
          <condition property="modules.supported.internal" value="true">
              <not>
                  <matches pattern="1\.[0-8](\..*)?" string="${javac.source}"/>
              </not>
          </condition>
      </target>
      
      ...
      
      <condition property="do.mkdist">
          <and>
              <isset property="do.archive"/>
              <isset property="libs.CopyLibs.classpath"/>
              <not>
                  <istrue value="${mkdist.disabled}"/>
              </not>
              <not>
                  <istrue value="${modules.supported.internal}"/>    <-- WHY THIS CONDITION??
              </not>
          </and>
      </condition>

      I've observed that mkdist.disabled setting is "Copy Dependent Libraries" checbox state negated. And do.mkdist controls the library copying.

      But why is this library copying connected to javac.source version in this way? If by design, what should I do in order to get jars copied to dist\lib\ as they used to?

      For now, a workaround seems to be manually deleting the weird

              <not>
                  <istrue value="${modules.supported.internal}"/>
              </not>

      part from build-impl.xml, but that needs to be re-done every time NetBeans recreates it.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            jpulakka Joonas Pulakka
            Votes:
            6 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 2h
                2h

                Slack

                  Issue deployment