2019-11-22 04:53:43 +01:00
|
|
|
diff -urEbwBN plexus-containers-plexus-containers-2.1.0/plexus-component-metadata/src/main/java/org/codehaus/plexus/metadata/PlexusMetadataGeneratorCli.java plexus-containers-plexus-containers-2.1.0.new/plexus-component-metadata/src/main/java/org/codehaus/plexus/metadata/PlexusMetadataGeneratorCli.java
|
|
|
|
--- plexus-containers-plexus-containers-2.1.0/plexus-component-metadata/src/main/java/org/codehaus/plexus/metadata/PlexusMetadataGeneratorCli.java 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
+++ plexus-containers-plexus-containers-2.1.0.new/plexus-component-metadata/src/main/java/org/codehaus/plexus/metadata/PlexusMetadataGeneratorCli.java 2019-11-22 04:47:34.934070355 +0100
|
|
|
|
@@ -0,0 +1,62 @@
|
|
|
|
+package org.codehaus.plexus.metadata;
|
|
|
|
+
|
|
|
|
+import java.io.File;
|
|
|
|
+import java.util.Arrays;
|
|
|
|
+import java.util.Collections;
|
|
|
|
+
|
|
|
|
+import org.apache.commons.cli.CommandLine;
|
2022-05-20 14:18:19 +02:00
|
|
|
+import org.apache.commons.cli.Option;
|
2019-11-22 04:53:43 +01:00
|
|
|
+import org.apache.commons.cli.Options;
|
|
|
|
+import org.codehaus.plexus.PlexusContainer;
|
|
|
|
+import org.codehaus.plexus.tools.cli.AbstractCli;
|
|
|
|
+
|
|
|
|
+public class PlexusMetadataGeneratorCli
|
|
|
|
+ extends AbstractCli
|
|
|
|
+{
|
2022-05-20 14:18:19 +02:00
|
|
|
+ public static final String SOURCE_DIRECTORY = "s";
|
|
|
|
+ public static final String SOURCE_ENCODING = "e";
|
|
|
|
+ public static final String CLASSES_DIRECTORY = "c";
|
|
|
|
+ public static final String OUTPUT_FILE = "o";
|
|
|
|
+ public static final String DESCRIPTORS_DIRECTORY = "m";
|
2019-11-22 04:53:43 +01:00
|
|
|
+
|
|
|
|
+ public static void main( String[] args )
|
|
|
|
+ throws Exception
|
|
|
|
+ {
|
|
|
|
+ new PlexusMetadataGeneratorCli().execute( args );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String getPomPropertiesPath()
|
|
|
|
+ {
|
|
|
|
+ return "META-INF/maven/org.codehaus.plexus/plexus-metadata-generator/pom.properties";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @SuppressWarnings("static-access")
|
|
|
|
+ public Options buildCliOptions( Options options )
|
|
|
|
+ {
|
2022-05-20 14:18:19 +02:00
|
|
|
+ options.addOption( Option.builder( SOURCE_DIRECTORY ).longOpt( "source" ).hasArg().desc( "Source directory." ).build() );
|
|
|
|
+ options.addOption( Option.builder( SOURCE_ENCODING ).longOpt( "encoding" ).hasArg().desc( "Source file encoding." ).build() );
|
|
|
|
+ options.addOption( Option.builder( CLASSES_DIRECTORY ).longOpt( "classes" ).hasArg().desc( "Classes directory." ).build() );
|
|
|
|
+ options.addOption( Option.builder( OUTPUT_FILE ).longOpt( "output" ).hasArg().desc( "Output directory." ).build() );
|
|
|
|
+ options.addOption( Option.builder( DESCRIPTORS_DIRECTORY ).longOpt( "descriptors" ).hasArg().desc( "Descriptors directory." ).build() );
|
2019-11-22 04:53:43 +01:00
|
|
|
+ return options;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void invokePlexusComponent( CommandLine cli, PlexusContainer plexus )
|
|
|
|
+ throws Exception
|
|
|
|
+ {
|
|
|
|
+ MetadataGenerator metadataGenerator = plexus.lookup( MetadataGenerator.class );
|
|
|
|
+
|
|
|
|
+ MetadataGenerationRequest request = new MetadataGenerationRequest();
|
|
|
|
+ request.classesDirectory = new File( cli.getOptionValue( CLASSES_DIRECTORY ) );
|
|
|
|
+ request.classpath = Collections.emptyList();
|
|
|
|
+ request.sourceDirectories = Arrays.asList( new String[]{ new File( cli.getOptionValue( SOURCE_DIRECTORY ) ).getAbsolutePath() } );
|
|
|
|
+ request.sourceEncoding = cli.getOptionValue( SOURCE_ENCODING );
|
|
|
|
+ request.useContextClassLoader = true;
|
|
|
|
+ request.outputFile = new File( cli.getOptionValue( OUTPUT_FILE ) );
|
|
|
|
+ request.componentDescriptorDirectory = new File( cli.getOptionValue( DESCRIPTORS_DIRECTORY ) );
|
|
|
|
+
|
|
|
|
+ metadataGenerator.generateDescriptor( request );
|
|
|
|
+ }
|
|
|
|
+}
|