Skip to content

Commit 0a8fd82

Browse files
committed
Mark test source folders and test dependencies as "test" for Eclipse 4.8 Photon (since 3.1.0)
1 parent 2fa633e commit 0a8fd82

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +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)
18+
* Mark test source folders and test dependencies as "test" for Eclipse 4.8 Photon (since 3.1.0)
1919

2020
To use this in your projects update all your POMs to use
2121

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public void write()
256256

257257
boolean attributeElemOpen = false;
258258

259-
// mark test dependencies as "test" (required for eclipse 4.8 photon)
259+
// mark test source folders as "test" (required for eclipse 4.8 photon)
260260
if ( dir.isTest() )
261261
{
262262
if ( !attributeElemOpen )
@@ -553,6 +553,21 @@ protected void addDependency( XMLWriter writer, IdeDependency dep )
553553

554554
boolean attributeElemOpen = false;
555555

556+
// mark test dependencies as "test" (required for eclipse 4.8 photon)
557+
if ( dep.isTestDependency() )
558+
{
559+
if ( !attributeElemOpen )
560+
{
561+
writer.startElement( ATTRIBUTES );
562+
attributeElemOpen = true;
563+
}
564+
565+
writer.startElement( ATTRIBUTE );
566+
writer.addAttribute( VALUE, "true" );
567+
writer.addAttribute( NAME, "test" );
568+
writer.endElement();
569+
}
570+
556571
if ( javadocpath != null )
557572
{
558573
if ( !attributeElemOpen )

0 commit comments

Comments
 (0)