cstamas commented on code in PR #806:
URL: https://github.com/apache/maven/pull/806#discussion_r978757139


##########
maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/PluginsMetadataGenerator.java:
##########
@@ -124,7 +128,46 @@ public Collection<? extends Metadata> finish( Collection<? 
extends Artifact> art
                 }
             }
         }
-
         return plugins.values();
     }
+
+    private PluginInfo extractPluginInfo( Artifact artifact )
+    {
+        // sanity: jar, no classifier and file exists
+        if ( artifact != null
+                && "jar".equals( artifact.getExtension() )
+                && "".equals( artifact.getClassifier() )
+                && artifact.getFile() != null )
+        {
+            Path artifactPath = artifact.getFile().toPath();
+            if ( Files.isRegularFile( artifactPath ) )
+            {
+                try ( JarFile artifactJar = new JarFile( 
artifactPath.toFile(), false ) )
+                {
+                    ZipEntry pluginDescriptorEntry = artifactJar.getEntry( 
PLUGIN_DESCRIPTOR_LOCATION );
+
+                    if ( pluginDescriptorEntry != null )
+                    {
+                        InputStream is = artifactJar.getInputStream( 
pluginDescriptorEntry );
+
+                        Reader reader = ReaderFactory.newXmlReader( is );
+
+                        PluginDescriptor pluginDescriptor =
+                                pluginDescriptorBuilder.build( reader, 
artifactPath.toAbsolutePath().toString() );

Review Comment:
   Maybe just load up DOM and drop plugin-api/plexus as deps?



-- 
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: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to