mirror of https://github.com/apache/maven.git
Minor fixes: proper help syntax and ability to extend core exports (#1799)
Display proper syntax on help, ability to extend core exports.
This commit is contained in:
parent
66b7e2c0be
commit
a293822852
|
@ -437,7 +437,7 @@ public abstract class CommonsCliOptions implements Options {
|
|||
formatter.printHelp(
|
||||
pw,
|
||||
width,
|
||||
command + " [args]",
|
||||
commandLineSyntax(command),
|
||||
System.lineSeparator() + "Options:",
|
||||
options,
|
||||
HelpFormatter.DEFAULT_LEFT_PAD,
|
||||
|
@ -447,5 +447,9 @@ public abstract class CommonsCliOptions implements Options {
|
|||
|
||||
pw.flush();
|
||||
}
|
||||
|
||||
protected String commandLineSyntax(String command) {
|
||||
return command + " [options] [goals]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,13 +99,10 @@ public class PlexusContainerCapsuleFactory<
|
|||
.setName("maven");
|
||||
customizeContainerConfiguration(context, cc);
|
||||
|
||||
Set<String> exportedArtifacts = new HashSet<>(coreEntry.getExportedArtifacts());
|
||||
Set<String> exportedPackages = new HashSet<>(coreEntry.getExportedPackages());
|
||||
for (CoreExtensionEntry extension : extensions) {
|
||||
exportedArtifacts.addAll(extension.getExportedArtifacts());
|
||||
exportedPackages.addAll(extension.getExportedPackages());
|
||||
}
|
||||
CoreExports exports = new CoreExports(containerRealm, exportedArtifacts, exportedPackages);
|
||||
CoreExports exports = new CoreExports(
|
||||
containerRealm,
|
||||
collectExportedArtifacts(coreEntry, extensions),
|
||||
collectExportedPackages(coreEntry, extensions));
|
||||
Thread.currentThread().setContextClassLoader(containerRealm);
|
||||
DefaultPlexusContainer container = new DefaultPlexusContainer(cc, getCustomModule(context, exports));
|
||||
|
||||
|
@ -153,6 +150,24 @@ public class PlexusContainerCapsuleFactory<
|
|||
return container;
|
||||
}
|
||||
|
||||
protected Set<String> collectExportedArtifacts(
|
||||
CoreExtensionEntry coreEntry, List<CoreExtensionEntry> extensionEntries) {
|
||||
Set<String> exportedArtifacts = new HashSet<>(coreEntry.getExportedArtifacts());
|
||||
for (CoreExtensionEntry extension : extensionEntries) {
|
||||
exportedArtifacts.addAll(extension.getExportedArtifacts());
|
||||
}
|
||||
return exportedArtifacts;
|
||||
}
|
||||
|
||||
protected Set<String> collectExportedPackages(
|
||||
CoreExtensionEntry coreEntry, List<CoreExtensionEntry> extensionEntries) {
|
||||
Set<String> exportedPackages = new HashSet<>(coreEntry.getExportedPackages());
|
||||
for (CoreExtensionEntry extension : extensionEntries) {
|
||||
exportedPackages.addAll(extension.getExportedPackages());
|
||||
}
|
||||
return exportedPackages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Note: overriding this method should be avoided. Preferred way to replace Maven components is the "normal" way
|
||||
* where the components are on index (are annotated with JSR330 annotations and Sisu index is created) and, they
|
||||
|
|
|
@ -116,5 +116,10 @@ public class CommonsCliEncryptOptions extends CommonsCliOptions implements Encry
|
|||
.desc("Should imply user answered \"yes\" to all incoming questions?")
|
||||
.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String commandLineSyntax(String command) {
|
||||
return command + " [options] [goal]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue