AutomaticProjects

Contents


This is all experimental so far.

Introduction for Testers

This is a project type which tries to infer IDE information (mainly about the Java classpath) automatically from running Ant builds or from other passive sources.

It is not a modified freeform project type; it is completely independent of the existing freeform project type. It is also not intended to be functionally complete for what you would want out of a project type; you get the basic edit/test/debug cycle using "Compile on Save", i.e. Run/Debug/Profile File on a main class or unit test should work without needing to run an Ant build.

For now, it exists mainly to determine whether it is possible to pick up reasonably accurate information about user source code without intervention. "Reasonably accurate" means that few or no error badges appear (for sources which in fact compile), code completion appears where appropriate, Find Usages and cross-source Rename work, etc.

There is some minimal support for Java EE development: web application source structures may be recognized, enabling IDE features to help edit JSPs and deployment descriptors.

Basic usage instructions

  1. Install Automatic Projects from updates in Plugin Manager. It is available in the Plugin Portal. For development build users, use the alpha update center.
  2. Use New Project and pick Java > Automatic Project to select the root folder of your project.
  • You have the option in this wizard to turn on automatic project detection mode, in which case any folder with a build.xml at top level will be considered a project and can be opened right away from Open Project. (Folders inside other projects do not count even if they have a build script.) This feature should be considered experimental.
  • If you have an existing freeform project, then (in the 6.8+ version) it will be converted to an automatic project. The old freeform metadata will be backed up in case you change your mind; use the Deregister menu item in this case.
  1. Try to Build the project; you will asked to pick an Ant target. As it runs, source trees which have been compiled should start to appear in the Projects tab. JARs you use should start to appear under Libraries.
  2. If you make build script changes affecting classpaths etc., just build again to refresh the IDE.
  3. Run or debug main classes or JUnit tests just like in a regular Java project. Save classes when the debugger is running to reload them. Rerun failed test methods from the JUnit Test Results window.

How to report issues

Everything the module writes to disk is in $userdir/var/cache/autoprojects.properties which you can inspect to see what it "knows".

Please file bugs under projects / Autoproject in Bugzilla. (Bugs relevant to automatic projects but actually caused by other modules should be in the appropriate component with autoproject in the Status Whiteboard.) You can add autoprojects.properties as an attachment if it does not contain any confidential information.

Adding -J-Dorg.netbeans.modules.autoproject.level=450 to your IDE startup options (e.g. etc/netbeans.conf) will provide some diagnostics in your IDE log file.

You can also get the NetBeans Project Metadata Inspector module, available on the Plugin Portal for 7.0, on development update centers, or as a direct NBM download. After installing, right-click a project node and select Inspect Project Metadata. You will see a dump in the Output Window of all kinds of relevant information. Pay attention to classpaths and associated sources in particular.

Major recent changes

NetBeans 6.8

Feb 25 2010:

  • new build for 6.8 beta update center

Jan 14 2010:

  • UnsupportedOperationException related to JSF

Nov 27 2009:

  • refinement to includes/excludes behavior

Nov 25 2009:

  • suppress a harmless IOException

Oct 21 2009:

  • easy way in GUI to try opening a freeform project as an autoproject and then switch back later if unsatisfied

Aug 11 2009:

  • better support includes/excludes when source root compiled several times in succession
  • trigger project scanning only when build completes, in case includes/excludes/classpath needed to be merged between runs of <javac>
  • handle source="6" like source="1.6"

NetBeans 6.7

Jul 30 2009: NPEs from web app support fixed.

Jul 01 2009: new build published for 6.7, including:

  • Select in Projects supported
  • bootclasspath, includes, excludes recognized on <javac>
  • various smaller fixes

NetBeans 6.5

Nov 11 2008: new build published for 6.5 with various fixes, and including Profiler integration (sources are in release65/contrib repository)

Development

Open issues

Related open issues

In contrib repo, in modules autoproject.*.

Call for test cases

Background

OSProjectsEvaluation

AutomaticProjectsBrainstorming

ProjectTypeMusings

VOC

  • classpath analysis
  • better static analysis of the existing build.xml - even if it were not 100% accurate - something would be a start
  • EAR projects (detection?)
  • project dependencies (?)
  • JUnit GUI (?)
  • Ant script "customization" (editing? startup options?)
  • should be no errors within a single source tree, at a minimum
  • debugging support
  • Libraries node should show entries from build.properties

Experiments

Ideally should try to (better!) handle everything in NetbeansReady.

OpenDS

Partially works. Lots and lots of source roots with terribly complex interrelationships.

Some generated. Some roots compiled piecemeal with a different classpath each time. Everything appears in Projects and mostly works, but still various error badges depending on which targets you ran, sometimes disappearing after files are opened. Perhaps impossible to fully support with current Java infrastructure.

GData-Java-Client

Doesn't really work. Samples use project dir as source root, whereas main sources use a subdir. Impossible to properly support in any project type.

Google-RFC-2445

Fairly simple. Seemed to work reasonably well. (build.xml has a bug - replace build.class.path with test.class.path in tests. Also need to add junit.jar to third_party/junit/.)

JSPWiki

Worked pretty well, except for problem displaying JUnit results (mentioned above). Also had up-to-date Eclipse metadata. Quick Run on unit tests does not take into account new modifications to tests, because build/JSPWiki-test.jar is added to the test CP, and BuildSniffer does not yet grok that this is an output of tests.

Genesis

Forget now, but some problems.

Guice

(Has IDEA metadata, build.xml, and a nonfunctional pom.xml.) One genuine compiler error and two genuine test failures. Running single tests (and test methods) works. Detected all source roots. Most look fine. spring/test etc. show error marks after doing a clean build since build/dist/guice-snapshot.jar was deleted, and the IDE does not realize this is a build product of src. Would be tricky for IDE to realize this, since build uses com.tonicsystems.jarjar.JarJarTask to create it. Some examples show error marks, but it does not seem possible to build them either.

Scala

(Has Eclipse metadata, complex build.xml.) Seems to work well.

Update Center 2

https://updatecenter2.dev.java.net/ seems to work fine if you delete the old freeform project metadata.

JAXP (in OpenJDK)

Need to use New Project and then run build target in make/build.xml. After that, seems to work fine.

Tomcat

Works (after you define jdt.jar to a meaningful path in build.properties). puretls and webservices packages are marked as erroneous; these are not in fact compiled. No obvious way to run tests.

Apache Ant

Works pretty well as of 1.8.2. (1.8.0/1.8.1 source trees have serious problems in classpath calculations.) Quick Run even works on most unit tests: BuildFileTest.configureProject has

File antFile = new File(System.getProperty("root"), filename);

which fortuitously works (the system property is unset but the CWD is in fact the project root). Some error badges, but just on optional tasks which in fact cannot be compiled without using fetch.xml. (Ideally these would be in their own source roots; proposed to Ant dev list.) Running single test methods does not work, probably because this needs a patched version of Ant.

BeanShell

Looks to work OK.

(Note: when running on JDK 6, compilation from Ant and from editor is broken because BSH appears to ship with an obsolete version of JSR 223 with a different signature for Invocable.)

Langtools subproject of OpenJDK

Works after you define necessary properties in ~/.openjdk/build.properties as usual. JTReg-based tests cannot be run individually, and no classpath for these tests is available, but the freeform project is no better and the packageless structure of this tree makes it very hard for NetBeans to work with anyway. Issue 151635 results in spurious error badges.

Xerces-J 2

Does not work well, due to unnecessary build script hacks:

  1. Special <xjavac> task (long since useless) prevents AP from recognizing that compilation is happening.
  2. Sources are copied to a build dir before compiling, so build/src is treated as the source root rather than src.

FindBugs

After deleting the obsolete nbproject subdir, works better than the freeform project did.

Java EE Blueprints

You have to first do some site setup (for Glassfish) as documented in user's guide. After deleting nbproject, mostly seems to work well. Fix main.xml to import the non-NB stuff directly (otherwise Ant navigator cannot find imported targets like clean due to exotic use of <condition> on a calculated <import>). Projects not recognized as web apps I guess because war-ant.xml uses <jar>; may be fixable since contents would contain WEB-INF and could be recognized. Some projects have default target which apparently does nothing (not sure why).

JUnit

Works fine. dist target runs tests without <junit> so they do not display in Test Results, but you can also run tests in CoS mode.

Android Sample App

Type in debug target for build, and can bind install to run action (if there is exactly one emulator or device attached). Main and generated sources detected correctly, and show no errors (due to use of correct bootclasspath). Could attach Javadoc (<SDK>/docs/reference) by creating a lib in Library Manager pointing to <SDK>/platforms/android-7/android.jar.

Would be nice if Android bootclasspath were displayed under Libraries. ant_rules_r2.xml in platform fails to set includeantruntime="false", so lots of Ant JARs are displayed. The project directory is included in the classpath for unknown reasons.

Hadoop-Common

Uses Ivy. compile target seem to be sniffed fairly well, modulo the usual includeantruntime mistake; /tmp/hadoop/conf added to CP for some reason.

test target seems to hang at 100% CPU in run-test-core; maybe issue in build script, or just failing to report progress, but when interrupted still detects unit tests OK, and CoS works for all the tests I checked.

build/src and build/test/src generated roots detected.

Rhino

https://github.com/mozilla/rhino can be opened easily; use default compile target and all source roots appear without error. Shift-F6 on org.mozilla.javascript.tools.shell.Main even works to start an interpreter shell.

JNA

After fix of #153234 and https://github.com/twall/jna/pull/22 worked well incl. unit tests.

JMol

Seems to work. Some error running tests relating to JAR signer (seems to be bug in build scripts).

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo