DataNucleus and IntelliJ IDEA

IntelliJ IDEA is one of the most powerful development environments and DataNucleus provides its own plugin for transparently embedding the class enhancer into IDEA's build cycle. Important : this plugin was written by Gerald Klinger using v11/12 of IDEA and v3 of DataNucleus. It has not been updated since so will likely NOT work with recent versions of IDEA and DataNucleus. The source code is available at GitHub and contributions are welcome to update it. You are advised to use IDEA's Maven/Ant integration instead.

Features and notes

What this plugin provides:

  • Transparent integration of the DataNucleus enhancer into IDEA's build cycle (classes will be enhanced automatically after build)
  • Automatic detection of DataNucleus project modules by scanning the classpath for DataNucleus enhancer
  • Enabling/Disabling class enhancement per project module
  • Enhancement in test output directory (can be deactivated)
  • Supports annotation- and file-based metadata
  • JDO and JPA support

Notes:

  • A project module will only be detected if DataNucleus enhancer is in its classpath
  • Enhancement will only work if DataNucleus enhancer -and- its dependencies are in the module-classpath
  • Detected Project modules will not be activated automatically, an initial activation via the plugins configuration dialog is necessary
  • Configuration dialog: classes subject to enhancement will only be shown after the first build.

Plugin Installation

The DataNucleus plugin is part of the official IntelliJ IDEA plugin repository, hence installing is a trivial task. Select File -> Settings to open the settings dialog and choose Plugins Activate tab Available and scroll or search to DataNucleus Enhancer integration Right-click and select Download and install
After restart go to the settings dialog again, chose DataNucleus Enhancer and activate the relevant project modules. See Plugin configuration.



If necessary, the plugin can also be downloaded from the official JetBrains plugin site for manual installation. Please refer to IDEA's documentation on how to do that.

Upgrading to a newer version

Updating older plugin versions to 1.0.4 or later does not work, they -must- be manually uninstalled before upgrading!
Ignore IDEA's auto-upgrade request in this case. If you're reading this too late, just uninstall and reinstall the plugin.

Plugin configuration

The DataNucleus IDEA plugin transparently persists it's configuration into the IDEA project file, hence opening a project will always restore it's last state.
The plugin configuration dialog can be found under File -> Settings -> DataNucleus Enhancer

  • Enable Enhancer : Enable/Disable the enhancer for the whole project. Also possible via
    Build -> DataNucleus Enhancer
  • JDO/JPA : Select the target api to enhance classes for
  • Include Test classes : If enabled, also test output will be processed
  • Metadata file extensions : If using metadata files instead of- or additionally to annotations, specify the file extensions to search for (e.g. when using JDO with annotations but having orm related configuration in separate xml files like 'ClassName.orm' or 'package.orm', then 'orm' has to be added here; for JPA 'xml' would have to be added to find a file named 'orm.xml')
  • Add compiler resource patterns : if enabled, metadata file extensions will be automatically added to
    File -> Settings -> Compiler -> Resource patterns
    In case of removing extensions, resource patterns have to be adapted manually
  • Affected Modules : List of project modules with datanucleus enhancer in classpath and subject to enhancement if checkbox under
    Enabled
    is active (Use this to activate/deactivate enhancement for specific project modules). Will become available after IDEA completed indexing the project.
  • Metadata and annotated classes for enhancement : List of detected classes for enhancement. Will become available after first build (only build target folders are scanned).