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 195123 - Offer to install JUnit on first start
Summary: Offer to install JUnit on first start
Alias: None
Product: java
Classification: Unclassified
Component: JUnit (show other bugs)
Version: 7.0
Hardware: All All
: P2 normal (vote)
Assignee: Jesse Glick
Depends on: 195041 195190
  Show dependency tree
Reported: 2011-02-07 11:01 UTC by Jaromir Uhrik
Modified: 2011-02-21 18:48 UTC (History)
9 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

Screenshot attached... (97.64 KB, image/png)
2011-02-07 11:01 UTC, Jaromir Uhrik

Note You need to log in before you can comment on or make changes to this bug.
Description Jaromir Uhrik 2011-02-07 11:01:07 UTC
Created attachment 105698 [details]
Screenshot attached...

Product Version: NetBeans IDE 7.0 Beta 2 (Build 201102052128)
Java: 1.6.0_22; Java HotSpot(TM) 64-Bit Server VM 17.1-b03-307
System: Mac OS X version 10.5.8 running on x86_64; MacRoman; en_US (nb)

When I create j2se project then there is reference problem on this project. See attached screenshot...
I understand that the JUnit libraries need to be installed to IDE but users might get confused. Especially those that are familiar with previous versions of NetBeans where no such approach is implemented.
Comment 1 Petr Jiricka 2011-02-07 14:56:40 UTC
I think this is higher priority and should be fixed for FCS - changing to P2. Any ideas how should this be solved?
Comment 2 Marian Mirilovic 2011-02-07 15:02:42 UTC
Definitely stopper for FCS, if possible please fix it for Beta 2 as well.
Comment 3 Jaromir Uhrik 2011-02-07 15:04:57 UTC
Yes, I agree that P2 better fits to this issue so that I agree that for FCS it should be fixed.
IMHO users need to be informed about the JUnit status during the creating of the project. I mean there should be an option to select whether the project should contain JUnit references or not. Yes option should contain some description about the need of additional JUnit binaries installation.
Comment 4 Jaromir Uhrik 2011-02-07 15:06:58 UTC
Sorry I have changed the priority by accident. I am changing back to P1.
Comment 5 Yulia Novozhilova 2011-02-07 15:44:06 UTC
Agree. The user should be informed about "junit situation" during the creating of
the project. So redirecting to "projects/Generic Projects UI". Please redirect to the correct component if I'm wrong.
Comment 6 Jesse Glick 2011-02-07 16:31:21 UTC
There was no plan to do anything in the New Project wizard. We have discussed adding the option to download JUnit and install it in the right place as an optional step in the installer. There will be no change for B2; simply download the JUnit lib and everything will be as before.
Comment 7 Jesse Glick 2011-02-08 18:15:33 UTC
*** Bug 195182 has been marked as a duplicate of this bug. ***
Comment 8 vanob 2011-02-09 08:14:56 UTC
Same with Java Web Application project.

At least give users detailed explanation how to add JUnit library, with what jars in it.
Comment 9 Jesse Glick 2011-02-09 14:44:04 UTC
(In reply to comment #8)
> give users detailed explanation how to add JUnit library, with what jars in it

Just click the Resolve button and this is handled automatically.
Comment 10 Jesse Glick 2011-02-09 20:51:21 UTC
As to implementation: before bug #195041 is implemented this would be tricky although shows that it is possible.

After that, it should suffice to get org-netbeans-libs-junit4.nbm and org-netbeans-modules-junitlib.nbm from the Stable UC and just place them in the NBM download dir so that the IDE on first start will install them itself, just as if you had downloaded them using Plugin Manager in a prior IDE session. You just need to have prompted the user to accept the CPL in the installer wizard.
Comment 11 Jaroslav Tulach 2011-02-10 10:34:26 UTC
Rather then downloading the NBM and relying on updater.jar to unpack it later, I'd prefer direct install. Either using APIs or via the AutoUpdate Ant task:

<taskdef name="autoupdate" classpath="${netbeans}/harness/tasks.jar" classname="org.netbeans.nbbuild.AutoUpdate"/>
<autoupdate installdir="${netbeans}" updatecenter="" force="false">
  <modules includes=".*junit.*" clusters="platform[0-9]*"/>

The download of JUnit shall be available only in Java based distributions and they are known to have Ant inside the Java cluster. Thus the whole code simplifiest to invoking Ant from installer (either with premade build.xml or directly).
Comment 12 Jiri Rechtacek 2011-02-10 14:25:43 UTC
No beta2 stopper, planned for FCS - possible solutions, open issue and UI mockup will be summarized at
Comment 13 Jesse Glick 2011-02-10 14:32:22 UTC
Using Ant, just like installer, suffers from proxy correctness issues. New plan is to offer the download (from the junit module) on first start - simple enough, works with the IDE's regular proxy settings assuming #195190.
Comment 14 Jesse Glick 2011-02-10 15:49:55 UTC
Implemented in trunk: core-main #89f1374440dc
Comment 15 Jesse Glick 2011-02-10 16:02:22 UTC
(In reply to comment #14)
> Implemented in trunk: core-main #89f1374440dc

And in b2: releases #d487ebab0e7d
Comment 16 Petr Jiricka 2011-02-10 16:23:34 UTC
> New plan is to offer the download (from the junit module) on first start

I think this is a temporary plan for beta 2 - for FCS, it would still be useful to have UI in the installer.

As for the installer solution, I agree that relying on updater.jar to unpack it is not the cleanest way. But could we use the solution to write the module files to nb/config? I.e. the installer would write nb/config/org-netbeans-api-project-libraries/Libraries/junit-*.xml. This is a solution that we already use for registering bundled runtimes (GlassFish, Tomcat, JavaDB).
Comment 17 Jesse Glick 2011-02-10 16:33:19 UTC
(In reply to comment #16)
> could we use the solution to write the module
> files to nb/config? I.e. the installer would write
> nb/config/org-netbeans-api-project-libraries/Libraries/junit-*.xml

For various reasons the modules (o.n.libs.junit4, o.n.m.junitlib) actually have to be installed, not just the library definitions. Of course the installer could create the appropriate files directly rather than going through AU:


However this is much more error-prone that just getting the NBMs from the Stable UC, since the installer would need to track every minor change in the content of these modules.
Comment 18 jrojcek 2011-02-14 13:47:51 UTC
Note that I've updated the spec with JUnit installation added to New File wizard and Create JUnit Tests action. They are a supplemental solution to the IDE installer.

Comment 19 Quality Engineering 2011-02-16 11:38:29 UTC
Integrated into 'main-golden', will be available in build *201102160501* on (upload may still be in progress)
User: Jesse Glick <>
Log: #195123: offer to install JUnit on first start.
Comment 20 chaase3 2011-02-21 18:33:27 UTC
I just installed netbeans-dev-201102210501 on Solaris. When I started NB, it offered me the option to download the Junit library. I clicked OK. However, the library didn't download and I got a stacktrace in the terminal window where I started NB:

INFO [org.netbeans.modules.autoupdate.updateprovider.DownloadListener]: Reading URL failed ( Timeout while opening connection to
INFO [org.netbeans.modules.junit.DownloadLibraryTask]: Could not install JUnit library
        at java.util.concurrent.FutureTask$Sync.innerGet(
        at java.util.concurrent.FutureTask.get(
        at org.netbeans.modules.autoupdate.updateprovider.NetworkAccess$Task$
Caused: Timeout while opening connection to
        at org.netbeans.modules.autoupdate.updateprovider.NetworkAccess$Task$
Caused: Timeout while opening connection to
        at org.netbeans.modules.autoupdate.updateprovider.DownloadListener.notifyException(
        at org.netbeans.modules.autoupdate.updateprovider.AutoupdateCatalogCache.copy(
        at org.netbeans.modules.autoupdate.updateprovider.AutoupdateCatalogCache.writeCatalogToCache(
        at org.netbeans.modules.autoupdate.updateprovider.AutoupdateCatalogProvider.refresh(
        at org.netbeans.api.autoupdate.UpdateUnitProvider.refresh(
        at org.netbeans.modules.junit.JUnitLibraryDownloader.access$000(
        at org.netbeans.modules.junit.JUnitLibraryDownloader$
        at org.netbeans.modules.junit.JUnitLibraryDownloader$
[catch] at org.netbeans.modules.junit.DownloadLibraryTask.perhapsDownload(
        at org.openide.util.RequestProcessor$
        at org.openide.util.RequestProcessor$

So now what? For a couple of Java EE Tutorial examples we actually need this library.
Comment 21 Jiri Rechtacek 2011-02-21 18:48:22 UTC
> --- Comment #20 from chaase3<>   2011-02-21 18:33:27 ---
> INFO [org.netbeans.modules.autoupdate.updateprovider.DownloadListener]: Reading
> failed ( Timeout while opening connection to
Either a problem with Network Proxy Settings, or temporary inaccessibility of this UC. You can install JUnit manually using Tools|Plugins in this case.