This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 63541 - Cannot specify Java Platform for building NetBeans projects
Summary: Cannot specify Java Platform for building NetBeans projects
Status: VERIFIED FIXED
Alias: None
Product: apisupport
Classification: Unclassified
Component: Project (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks: 75082
  Show dependency tree
 
Reported: 2005-09-01 17:55 UTC by Martin Brehovsky
Modified: 2006-01-13 15:47 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
First draft; build script changes only (18.30 KB, patch)
2005-12-23 18:39 UTC, Jesse Glick
Details | Diff
Refined patch (still build scripts only); also: files-layout.txt, and s!${jdkhome}/lib/tools.jar!${tools.jar}!g in various build.xml and project.properties (34.12 KB, patch)
2005-12-23 21:37 UTC, Jesse Glick
Details | Diff
New running patch (incl. a few unrelated project.xml changes) (12.58 KB, application/octet-stream)
2005-12-26 16:58 UTC, Jesse Glick
Details
Changes needed for code completion etc. to work (18.97 KB, patch)
2005-12-26 18:51 UTC, Jesse Glick
Details | Diff
GUI patch (53.13 KB, patch)
2005-12-26 22:41 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Brehovsky 2005-09-01 17:55:33 UTC
When using apisupport to develop netbeans modules, I cannot specify a Java
Platform to be used to build the project. This might lead to problems when the
IDE is running in 1.5, but 1.4.2 is required to build the modules.
Comment 1 Jesse Glick 2005-09-01 18:06:04 UTC
It is rare to actually require the earlier JDK to build modules, since <javac>
is run with source="1.4" or whatever you specify, and there are few source
incompatibilities between JDK releases. (Usually just things like people
implementing AWT peers or DOM interfaces.)

However there might be an error that would be caught when compiling under JDK
1.4.2 which is not caught when compiling under JDK 1.5.

On the other hand, assuming you have a 1.4 JDK registered in the Java Platform
Manager, it will be used for code completion and background compilation, so you
should e.g. see error highlights immediately upon accidentally typing

  if (something.getName().contains(" ")) {

since the 1.4 java.lang.String has no 'contains' method.

A problem with this is that line numbers in JDK sources (from stack traces,
debugging, ...) will not match up if you have a 1.4 JDK registered.

Some apps might really need to be tested on the earlier JDK, not on the IDE's JDK.

Anyway, currently no plans to fix in 4.2 - there just wasn't time; and it's a
format + UI change, so too late unless an exception is granted.
Comment 2 Jan Chalupa 2005-09-12 14:34:26 UTC
P2 DEFECT? It would certainly be convenient to be able to specify the JDK to
build on and it's on the feature list for future versions. It most likely won't
be implemted for NB 5.0.

It seems to me that for a majority of cases, the user should be able to use a
simple workaround: run the IDE on the JDK that should be used as the platform
for building NB module projects. Is there a specific scenario where this
workaround wouldn't work?
Comment 3 Martin Brehovsky 2005-09-12 15:17:35 UTC
OK, P2 is perhaps too high (i'm lowering the issue to P3).

On the other hand every other project type (J2SE, J2EE, J2ME) allows the user to
specify JDK to be used to build the project. 

Personally I find this "defect" quite annoying, since I'm running NetBeans on
1.5 (I'm using antialiased text in Swing widgets), developing for 1.4, therefore
I have to build the projects manually from the command line.

Anyway it would be very nice to have such ability in api support.
Comment 4 Jesse Glick 2005-09-12 23:50:25 UTC
FWIW, I agreed with the P2 categorization. Running the IDE on an older JDK is
not a reasonable workaround.
Comment 5 Jesse Glick 2005-12-23 18:39:43 UTC
Created attachment 28057 [details]
First draft; build script changes only
Comment 6 Jesse Glick 2005-12-23 18:40:22 UTC
Working on it. Nothing too hard, but lots of details to take care of.
Comment 7 Jesse Glick 2005-12-23 21:37:28 UTC
Created attachment 28058 [details]
Refined patch (still build scripts only); also: files-layout.txt, and s!${jdkhome}/lib/tools.jar!${tools.jar}!g in various build.xml and project.properties
Comment 8 Jesse Glick 2005-12-26 14:28:18 UTC
Current build script patch does not work, due to an Ant bug (or design flaw):

http://issues.apache.org/bugzilla/show_bug.cgi?id=38040

Build fails when calling into a module like mdr/module which is a wrapper for a
j2seproject: the j2seproject gets the presetdef for <javac> but not the actual
property ${nbjdk.javac}.
Comment 9 Jesse Glick 2005-12-26 14:41:13 UTC
Need to patch module build scripts which call an external script like this:

<ant ... inheritall="false"/>

to read:

<ant ... inheritall="false">
    <propertyset>
        <propertyref prefix="nbjdk."/>
    </propertyset>
</ant>
Comment 10 Jesse Glick 2005-12-26 15:05:14 UTC
Tried to use a presetdef on <ant> itself to get that effect, but doesn't work:
Ant 1.6.5 uses (Ant) getProject().createTask("ant") in <antcall/>
(CallTarget.java), which then fails with a CCE if you presetdef'd <ant>.

This bug is fixed in Ant 1.7, but too late for us:

svn log -r277700 https://svn.apache.org/repos/asf/ant/core/trunk
------------------------------------------------------------------------
r277700 | stevel | 2005-02-18 18:28:00 -0500 (Fri, 18 Feb 2005) | 4 lines

This commit eliminates all (but one) use of Project.createTask("some name") from
the codebase. [...]
------------------------------------------------------------------------
Comment 11 Jesse Glick 2005-12-26 16:55:30 UTC
Found a different workaround, no need for patches to module build scripts.
Comment 12 Jesse Glick 2005-12-26 16:58:36 UTC
Created attachment 28072 [details]
New running patch (incl. a few unrelated project.xml changes)
Comment 13 Jesse Glick 2005-12-26 18:51:59 UTC
Created attachment 28073 [details]
Changes needed for code completion etc. to work
Comment 14 Jesse Glick 2005-12-26 22:41:11 UTC
Created attachment 28078 [details]
GUI patch
Comment 15 Jesse Glick 2005-12-26 23:44:50 UTC
Implemented:

committed 1.10  ant/debugger/nbproject/project.properties
committed 1.25  ant/nbproject/project.properties
committed 1.6   apisupport/harness/build.xml
committed 1.9   apisupport/harness/manifest.mf
committed 1.11  apisupport/harness/nbproject/project.properties
committed 1.28  apisupport/harness/release/README
committed 1.8   apisupport/harness/release/build.xml
committed 1.26  apisupport/harness/release/jnlp.xml
committed 1.14  apisupport/harness/release/run.xml
committed 1.25  apisupport/harness/release/suite.xml
committed 1.134
apisupport/project/src/org/netbeans/modules/apisupport/project/NbModuleProject.java
committed 1.6  
apisupport/project/src/org/netbeans/modules/apisupport/project/queries/ClassPathProviderImpl.java
committed 1.67 
apisupport/project/src/org/netbeans/modules/apisupport/project/ui/customizer/Bundle.properties
committed 1.11 
apisupport/project/src/org/netbeans/modules/apisupport/project/ui/customizer/CustomizerLibraries.form
committed 1.41 
apisupport/project/src/org/netbeans/modules/apisupport/project/ui/customizer/CustomizerLibraries.java
added     1.1  
apisupport/project/src/org/netbeans/modules/apisupport/project/ui/customizer/JavaPlatformComponentFactory.java
committed 1.10 
apisupport/project/src/org/netbeans/modules/apisupport/project/ui/customizer/ModuleProperties.java
committed 1.46 
apisupport/project/src/org/netbeans/modules/apisupport/project/ui/customizer/SingleModuleProperties.java
committed 1.10 
apisupport/project/src/org/netbeans/modules/apisupport/project/ui/customizer/SuiteCustomizerLibraries.form
committed 1.23 
apisupport/project/src/org/netbeans/modules/apisupport/project/ui/customizer/SuiteCustomizerLibraries.java
committed 1.25 
apisupport/project/src/org/netbeans/modules/apisupport/project/ui/customizer/SuiteProperties.java
committed 1.33 
apisupport/project/test/unit/src/org/netbeans/modules/apisupport/project/NbModuleProjectTest.java
committed 1.30 
apisupport/project/test/unit/src/org/netbeans/modules/apisupport/project/TestBase.java
committed 1.5   debuggerjpda/ant/nbproject/project.properties
committed 1.6   debuggerjpda/api/nbproject/project.properties
committed 1.2  
debuggerjpda/api_examples/FilterringOfCallStackViews1/nbproject/project.properties
committed 1.2  
debuggerjpda/api_examples/SmartSteppingListener1/nbproject/project.properties
committed 1.10  debuggerjpda/nbproject/project.properties
committed 1.4   debuggerjpda/ui/nbproject/project.properties
committed 1.126 ide/golden/files-layout.txt
committed 1.6   ide/projectimport/nbproject/project.properties
committed 1.12  j2ee/ddapi/nbproject/project.properties
committed 1.3   j2ee/debug/nbproject/project.properties
committed 1.2   j2eeserver/ant/nbproject/project.properties
committed 1.24  java/j2seproject/nbproject/project.properties
committed 1.18  java/project/nbproject/project.properties
committed 1.721 nbbuild/build.xml
committed 1.11  nbbuild/default-properties.xml
committed 1.20  nbbuild/default.xml
added     1.1   nbbuild/jdk.xml
committed 1.31  nbbuild/misc/full-build-linux.sh
committed 1.31  nbbuild/nbproject/project.xml
committed 1.29  nbbuild/templates/common.xml
committed 1.62  nbbuild/templates/projectized.xml
committed 1.38  testtools/build.xml
committed 1.18  web/ddapi/nbproject/project.properties
committed 1.16  web/project/nbproject/project.properties
committed 1.13  websvc/core/nbproject/project.properties
committed 1.81  xml/core/build.xml
committed 1.70  xml/tax/build.xml
Comment 16 Jesse Glick 2005-12-27 00:12:09 UTC
Also:

Checking in project.xml;
/cvs/nbbuild/nbproject/project.xml,v  <--  project.xml
new revision: 1.32; previous revision: 1.31
done
Comment 17 Tomas Danek 2006-01-13 15:47:05 UTC
verified just implementation; will be tested for 5.1 and posible issues will be
filed separatly. V.