Question

I have a legacy java project that we have been moving to buildr/artifactory from ant/jars in svn.

The primary code is in the default (src/main/java) folder, but we have a few external source paths, for various tests that we can't move into the default folder, but we want to have access with it.

Currently, when adding a new library/regenerating IDE fields, it does not pick up these source paths, and I can't find a succinct discussion in the buildr manual for how to actually add them, rather than re-adding everything manually in eclipse (which just gets wiped out on the next regen).

Any idea how to have multiple source paths get picked up explicitly by buildr so that the idea/eclipse targets generate properly?

Was it helpful?

Solution

There are two ways that I know will work with IDEA. The second one might also work with Eclipse, while the first is specific to the idea task.

The IDEA-specific solution:

define 'proj' do
   # ...
   iml.main_source_directories << _('src/other')
end

iml also has test_source_directories and excluded_directories arrays you can append to.

The possibly eclipse-compatible solution, with more background than you probably want:

The iml object gets its default values for the main and test source directory arrays from project.compile.sources and project.test.compile.sources (slight simplification; resources are considered also). Buildr defines these .sources project attributes from the layout, so instead of explicitly appending to the iml attributes, you could use a custom layout for your project that includes your special source paths. That might work with the eclipse task, but I haven't tried it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top