@@ -36,8 +36,10 @@ abstract class ProcessClassesMojo extends AbstractMojo {
36
36
37
37
/**
38
38
* The location of the Java 8 JDK (not JRE).
39
+ *
40
+ * @since 1.2.0
39
41
*/
40
- @ Parameter (required = false , property = "java8home" , defaultValue = "${env.JAVA8_HOME}" )
42
+ @ Parameter (defaultValue = "${env.JAVA8_HOME}" , property = "java8home" , required = true )
41
43
public String java8home ;
42
44
43
45
/**
@@ -46,32 +48,22 @@ abstract class ProcessClassesMojo extends AbstractMojo {
46
48
* with the target JVM provided the known limitations are considered. See
47
49
* <a href="https://github.com/orfjackal/retrolambda">project documentation</a>
48
50
* for more details.
51
+ *
52
+ * @since 1.2.0
49
53
*/
50
- @ Parameter (required = false , property = "retrolambdaTarget" , defaultValue = "1.7" )
54
+ @ Parameter (defaultValue = "1.7" , property = "retrolambdaTarget" , required = true )
51
55
public String target ;
52
56
53
- /**
54
- * The directory containing the main (non-test) compiled classes. These
55
- * classes will be overwritten with bytecode changes to obtain compatibility
56
- * with target Java runtime.
57
- */
58
- @ Parameter (required = false , property = "retrolambdaMainClassesDir" , defaultValue = "${project.build.outputDirectory}" )
59
- public String mainClassesDir ;
60
-
61
- /**
62
- * The directory containing the compiled test classes. These classes will be
63
- * overwritten with bytecode changes to obtain compatibility with target
64
- * Java runtime.
65
- */
66
- @ Parameter (required = false , property = "retrolambdaTestClassesDir" , defaultValue = "${project.build.testOutputDirectory}" )
67
- public String testClassesDir ;
68
-
69
57
private final ClassesType classesType ;
70
58
71
59
ProcessClassesMojo (ClassesType classesType ) {
72
60
this .classesType = classesType ;
73
61
}
74
62
63
+ protected abstract File getInputDir ();
64
+
65
+ protected abstract File getOutputDir ();
66
+
75
67
@ Override
76
68
public void execute () throws MojoExecutionException {
77
69
validateJava8home ();
@@ -97,9 +89,9 @@ public void execute() throws MojoExecutionException {
97
89
98
90
getLog ().info ("Processing classes with Retrolambda" );
99
91
if (classesType == ClassesType .MAIN ) {
100
- processClasses (mainClassesDir , "maven.compile.classpath" );
92
+ processClasses ("maven.compile.classpath" );
101
93
} else {
102
- processClasses (testClassesDir , "maven.test.classpath" );
94
+ processClasses ("maven.test.classpath" );
103
95
}
104
96
}
105
97
@@ -118,7 +110,7 @@ private void validateJava8home() throws MojoExecutionException {
118
110
}
119
111
}
120
112
121
- private void processClasses (String inputDir , String classpathId ) throws MojoExecutionException {
113
+ private void processClasses (String classpathId ) throws MojoExecutionException {
122
114
String retrolambdaJar = getRetrolambdaJarPath ();
123
115
executeMojo (
124
116
plugin (groupId ("org.apache.maven.plugins" ),
@@ -135,7 +127,8 @@ private void processClasses(String inputDir, String classpathId) throws MojoExec
135
127
attribute ("executable" , java8home + "/bin/java" ),
136
128
attribute ("failonerror" , "true" )),
137
129
element ("arg" , attribute ("value" , "-Dretrolambda.bytecodeVersion=" + targetBytecodeVersions .get (target ))),
138
- element ("arg" , attribute ("value" , "-Dretrolambda.inputDir=" + inputDir )),
130
+ element ("arg" , attribute ("value" , "-Dretrolambda.inputDir=" + getInputDir ().getAbsolutePath ())),
131
+ element ("arg" , attribute ("value" , "-Dretrolambda.outputDir=" + getOutputDir ().getAbsolutePath ())),
139
132
element ("arg" , attribute ("value" , "-Dretrolambda.classpath=${the_classpath}" )),
140
133
element ("arg" , attribute ("value" , "-javaagent:" + retrolambdaJar )),
141
134
element ("arg" , attribute ("value" , "-jar" )),
0 commit comments