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(
|
formatter.printHelp(
|
||||||
pw,
|
pw,
|
||||||
width,
|
width,
|
||||||
command + " [args]",
|
commandLineSyntax(command),
|
||||||
System.lineSeparator() + "Options:",
|
System.lineSeparator() + "Options:",
|
||||||
options,
|
options,
|
||||||
HelpFormatter.DEFAULT_LEFT_PAD,
|
HelpFormatter.DEFAULT_LEFT_PAD,
|
||||||
|
@ -447,5 +447,9 @@ public abstract class CommonsCliOptions implements Options {
|
||||||
|
|
||||||
pw.flush();
|
pw.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String commandLineSyntax(String command) {
|
||||||
|
return command + " [options] [goals]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,13 +99,10 @@ public class PlexusContainerCapsuleFactory<
|
||||||
.setName("maven");
|
.setName("maven");
|
||||||
customizeContainerConfiguration(context, cc);
|
customizeContainerConfiguration(context, cc);
|
||||||
|
|
||||||
Set<String> exportedArtifacts = new HashSet<>(coreEntry.getExportedArtifacts());
|
CoreExports exports = new CoreExports(
|
||||||
Set<String> exportedPackages = new HashSet<>(coreEntry.getExportedPackages());
|
containerRealm,
|
||||||
for (CoreExtensionEntry extension : extensions) {
|
collectExportedArtifacts(coreEntry, extensions),
|
||||||
exportedArtifacts.addAll(extension.getExportedArtifacts());
|
collectExportedPackages(coreEntry, extensions));
|
||||||
exportedPackages.addAll(extension.getExportedPackages());
|
|
||||||
}
|
|
||||||
CoreExports exports = new CoreExports(containerRealm, exportedArtifacts, exportedPackages);
|
|
||||||
Thread.currentThread().setContextClassLoader(containerRealm);
|
Thread.currentThread().setContextClassLoader(containerRealm);
|
||||||
DefaultPlexusContainer container = new DefaultPlexusContainer(cc, getCustomModule(context, exports));
|
DefaultPlexusContainer container = new DefaultPlexusContainer(cc, getCustomModule(context, exports));
|
||||||
|
|
||||||
|
@ -153,6 +150,24 @@ public class PlexusContainerCapsuleFactory<
|
||||||
return container;
|
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
|
* 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
|
* 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?")
|
.desc("Should imply user answered \"yes\" to all incoming questions?")
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String commandLineSyntax(String command) {
|
||||||
|
return command + " [options] [goal]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue