desruisseaux commented on code in PR #508:
URL: https://github.com/apache/maven-jar-plugin/pull/508#discussion_r3891809210
##########
src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java:
##########
@@ -207,167 +205,208 @@ protected final Log getLog() {
protected abstract String getType();
/**
- * Returns the JAR file to generate, based on an optional classifier.
+ * {@return the scope of dependencies}
+ * It should be {@link PathScope#MAIN_COMPILE} or {@link
PathScope#TEST_COMPILE}.
+ * Note that we use compile scope rather than runtime scope because
dependencies
+ * cannot appear in {@code requires} statement if they didn't had compile
scope.
+ */
+ protected abstract PathScope getDependencyScope();
+
+ /**
+ * {@return the JAR tool to use for archiving the code}
*
- * @param basedir the output directory
- * @param resultFinalName the name of the JAR file
- * @param classifier an optional classifier
- * @return the file to generate
+ * @throws MojoException if no JAR tool was found
+ *
+ * @since 4.0.0-beta-2
*/
- protected Path getJarFile(Path basedir, String resultFinalName, String
classifier) {
- Objects.requireNonNull(basedir, "basedir is not allowed to be null");
- Objects.requireNonNull(resultFinalName, "finalName is not allowed to
be null");
- String fileName = resultFinalName + (hasClassifier(classifier) ? '-' +
classifier : "") + ".jar";
- return basedir.resolve(fileName);
+ protected ToolProvider getJarTool() throws MojoException {
Review Comment:
Yes package access would suffice. Some method are protected because they
were already protected in the previous version. Some other methods are
protected for consistency. In this case, it is because it is a powerful
overriding point. By overriding this method, a subclass can change completely
the tool used for generating the JAR file.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]