...
To develop on Daffodil using Eclipse, you will need Eclipse with the Scala IDE add-ins. Versions from 4.5 (Mars) seem to work acceptablyThe ScalaIDE add-ins are not being maintained however (as of 2021-02-01), and latest version of them is from 2018. However, the ScalaIDE does still work quite well with Daffodil.
- Downloading the entire ScalaIDE 4.7 (pre-built) works reliably.
- Loading the ScalaIDE from the update site has been unreliable at creating a real working environment.
- Specifically: Eclipse 20-12 does not work with the ScalaIDE update site for ScalaIDE 4.7.
You will need the Java SDK (not just the JRE), and Daffodil requires Java 8 (aka 1.8) at least.
The daffodil tree includes a sub-directory called eclipse-projects. These can all be imported to Daffodil
An Eclipse 'Linked Resource' named DAFFODIL_ROOT must be defined to be the path to the clone of the git repository for Daffodil.
ScalaIDE 4.7 also requires Java 8 (not newer), so Java 8 JDK is a hard requirement.
- If you are also using other JVM versions or want the default Java to be a newer one, then you can setup the eclipse.ini for ScalaIDE to specifically always use the Java 8 installation.
- See this page: https://wiki.eclipse.org/Eclipse.ini
Setup Eclipse Projects
For Daffodil 3.0.0 and older:
Enable the sbt ecilpse plugin by create the file
~/.sbt/1.0/plugins/plugins.sbt
with the following contentCode Block language scala title plugins.sbt addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.2.4")
Set the DAFFODIL_HOME environment variable to the directory where you have Daffodil checked out. You can run the following, or put it in configureation file like ~/.bashrc
Code Block export DAFFODIL_HOME="/path/to/daffodil.git"
Run the following sbt command to generate eclipse project files:
Code Block sbt updateClassifiers compile eclipse updateEclipseClasspaths
For Daffodil 3.1.0 and newer:
Run the following sbt command to generate eclipse project files:
Code Block sbt updateClassifiers compile eclipse
For all Daffodil versions:
The above will create an Eclipse .project, .classpath and .settings within each sub-project.
Then in Eclipse...
- First turn off automatic build
- Project menu at top, ensure "Build Automatically" is unchecked.
- Import all the daffodil projects
- File -> Import, Projects from Git, Existing local repository,
- select the daffodil directory -> next -> Import existing Eclipse projects -> Next.
- All projects should be pre-selected for you. -> Next.
- You should now have a collection of project folders displayed in the package explorer.
- Fix daffodil-lib (This may be unnecessary. Check it, but 'sbt eclipse' seems to set this up properly.)
- resource_managed/main folder: right-click Build-Path → add as source folder.
- src_managed/main folder also add as source folder
- Fix daffodil-japi: Edit daffodil-japi/.settings/org.scala-ide.sdt.core.prefs
- Delete the line that begins with "XPlugin="
- Delete the line that begins with "P="
- Select and refresh all projects.
You can now build all projects, and run tests in the ordinary Eclipse way.
These projects are all set up to use a common lib_managed project directory that is an Eclipse link to the DAFFODIL_ROOT/lib_managed which is populated using sbt. See the note below about "pre-build with sbt".
Line Endings
Setup Eclipse for "Unix" style line endings - single LF characters, not MS-DOS style CRLF endings.
Pre-build with sbt to Retrieve Libraries
Before starting Eclipse, you must issue the 'sbt updateClassifiers compile' command. This pulls down all libraries needed, and puts them into lib_managed where the eclipse projects are setup to find them. This also pulls down all the source and javadoc jars for convenient access. The compile command forces some code-generator steps to run which create source code in the daffodil-lib module.
Build Macro Lib First
Before building the rest of the Daffodil modules, you must first build daffodil-macro-lib. This defines macros that are used in the other modulesThis 'sbt updateClassifiers compile' must be repeated any time the daffodil-propgen module is changed.
Eclipse Settings for DFDL Schema Authoring/Editing
...
Window > Preferences > Validation
- turn off
XML Schema Validator
- turn off
DTD Validator and HTML Validator
- click the
...
settings box to the right ofXML Validator
.- Select
Include Group
- Click
Add Rule
- Select
File Extension
- Click
Next
- Add extensions
tdml
- Click
Finish
- Repeat steps
i-vi
, replacingtdml
withdfdl.xsd
- Select
- turn off
Window > Preferences > General > Content Types
- Select
Text > XML
- Click
Add...
- Set Content type to
*.dfdl.xsd
- Repeat steps
b-c
with content type set to *.tdml
- Select
Window > Preferences > XML > XML Files > Editor
- Uncheck
Format comments
- Uncheck
- Turn off HTML validation.
File > Import > XML > XML Catalog
- Choose daffodil-lib/src/main/resources/eclipse-xml-catalog.xml
Graphics Problems on Linux/Fedora
...