Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ protected Object newInstance(final Class<?> bootClass)
if ((constructor.getModifiers() & Modifier.PRIVATE) != 0) {
throw new NoSuchMethodException("No public constructor found for " + bootClass);
}
constructor.setAccessible(true);
return constructor.newInstance();
}

Expand Down
7 changes: 7 additions & 0 deletions src/test/java/CompactClass.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class CompactClass {


void main() {
System.out.println("Hello World");
}
}
14 changes: 14 additions & 0 deletions src/test/java/org/codehaus/mojo/exec/ExecJavaMojoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,20 @@ void runWithArgs(ExecJavaMojo mojo) throws Exception {
assertEquals(expectedResult, resultString);
}

/**
* Test the commandline parsing facilities of the {@link AbstractExecMojo} class
*
* @throws Exception if any exception occurs
*/
@Test
@InjectMojo(goal = "java")
@MojoParameter(name = "mainClass", value = "CompactClass")
void runCompact(ExecJavaMojo mojo) throws Exception {
String resultString = execute(mojo);

assertEquals("Hello World", resultString);
}

/**
* Ensures that classpath can be filtered (exclude from plugin deps or project deps) to resolve conflicts.
*
Expand Down