Skip to content

Commit 63bf222

Browse files
committed
Mark test source folders as "test" for Eclipse 4.8 Photon (since 3.1.0)
1 parent b363299 commit 63bf222

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Changes since the original Maven Eclipse Plugin 2.10:
1515

1616
* Patch from [MECLIPSE-641](https://issues.apache.org/jira/browse/MECLIPSE-641) which was never applied to the original code base, but is important for generating the eclipse project settings (since 3.0.0)
1717
* Add support for `filtering` property on additionalConfig files (since 3.1.0)
18+
* Mark test source folders as "test" for Eclipse 4.8 Photon (since 3.1.0)
1819

1920
To use this in your projects update all your POMs to use
2021

src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,28 @@ public void write()
254254
writer.addAttribute( ATTR_EXCLUDING, excludes );
255255
}
256256

257+
boolean attributeElemOpen = false;
258+
259+
// mark test dependencies as "test" (required for eclipse 4.8 photon)
260+
if ( dir.isTest() )
261+
{
262+
if ( !attributeElemOpen )
263+
{
264+
writer.startElement( ATTRIBUTES );
265+
attributeElemOpen = true;
266+
}
267+
268+
writer.startElement( ATTRIBUTE );
269+
writer.addAttribute( VALUE, "true" );
270+
writer.addAttribute( NAME, "test" );
271+
writer.endElement();
272+
}
273+
274+
if ( attributeElemOpen )
275+
{
276+
writer.endElement();
277+
}
278+
257279
writer.endElement();
258280

259281
}

0 commit comments

Comments
 (0)