felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1854549 - in /felix/trunk/tools/maven-bundle-plugin: ./ src/main/java/org/apache/felix/bundleplugin/ src/test/java/org/apache/felix/bundleplugin/
Date Thu, 28 Feb 2019 21:15:15 GMT
Author: gnodet
Date: Thu Feb 28 21:15:15 2019
New Revision: 1854549

URL: http://svn.apache.org/viewvc?rev=1854549&view=rev
Log:
[FELIX-6073] Upgrade to Maven 3

Modified:
    felix/trunk/tools/maven-bundle-plugin/pom.xml
    felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java
    felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/AntPlugin.java
    felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java
    felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
    felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java
    felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/DependencyExcluder.java
    felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/InstructionsPlugin.java
    felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
    felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/AbstractBundlePluginTest.java
    felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BlueprintComponentTest.java
    felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java
    felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java

Modified: felix/trunk/tools/maven-bundle-plugin/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/tools/maven-bundle-plugin/pom.xml?rev=1854549&r1=1854548&r2=1854549&view=diff
==============================================================================
--- felix/trunk/tools/maven-bundle-plugin/pom.xml (original)
+++ felix/trunk/tools/maven-bundle-plugin/pom.xml Thu Feb 28 21:15:15 2019
@@ -192,7 +192,17 @@
   <dependency>
    <groupId>org.apache.maven</groupId>
    <artifactId>maven-core</artifactId>
-   <version>2.2.0</version>
+   <version>3.3.9</version>
+  </dependency>
+  <dependency>
+    <groupId>org.apache.maven</groupId>
+    <artifactId>maven-compat</artifactId>
+    <version>3.3.9</version>
+  </dependency>
+  <dependency>
+    <groupId>org.apache.maven.reporting</groupId>
+    <artifactId>maven-reporting-api</artifactId>
+    <version>3.0</version>
   </dependency>
   <dependency>
    <groupId>org.apache.maven</groupId>
@@ -237,6 +247,12 @@
    <scope>test</scope>
   </dependency>
   <dependency>
+   <groupId>org.eclipse.aether</groupId>
+   <artifactId>aether-impl</artifactId>
+   <version>1.1.0</version>
+   <scope>tet</scope>
+  </dependency>
+  <dependency>
    <groupId>org.jdom</groupId>
    <artifactId>jdom</artifactId>
    <version>1.1</version>

Modified: felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java
URL: http://svn.apache.org/viewvc/felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java?rev=1854549&r1=1854548&r2=1854549&view=diff
==============================================================================
--- felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java (original)
+++ felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java Thu Feb 28 21:15:15 2019
@@ -24,7 +24,6 @@ import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.regex.Pattern;
 
 import org.apache.maven.artifact.Artifact;
@@ -35,13 +34,6 @@ import org.apache.maven.plugin.MojoExecu
 import aQute.bnd.header.Attrs;
 import aQute.bnd.header.OSGiHeader;
 import aQute.bnd.osgi.Instruction;
-import org.apache.maven.shared.dependency.graph.DependencyNode;
-import org.apache.maven.shared.dependency.graph.filter.ArtifactDependencyNodeFilter;
-import org.apache.maven.shared.dependency.graph.filter.DependencyNodeFilter;
-import org.apache.maven.shared.dependency.graph.traversal.BuildingDependencyNodeVisitor;
-import org.apache.maven.shared.dependency.graph.traversal.CollectingDependencyNodeVisitor;
-import org.apache.maven.shared.dependency.graph.traversal.DependencyNodeVisitor;
-import org.apache.maven.shared.dependency.graph.traversal.FilteringDependencyNodeVisitor;
 
 
 /**
@@ -55,18 +47,13 @@ public abstract class AbstractDependency
     private static final String PLACEHOLDER = "$$PLACEHOLDER$$";
 
     /**
-     * Dependency Graph.
-     */
-    private final DependencyNode m_dependencyGraph;
-    /**
      * Dependency artifacts.
      */
     private final Collection<Artifact> m_dependencyArtifacts;
 
 
-    public AbstractDependencyFilter( DependencyNode dependencyGraph, Collection<Artifact> dependencyArtifacts )
+    public AbstractDependencyFilter( Collection<Artifact> dependencyArtifacts )
     {
-        m_dependencyGraph = dependencyGraph;
         m_dependencyArtifacts = dependencyArtifacts;
     }
 
@@ -107,27 +94,6 @@ public abstract class AbstractDependency
         }
     }
 
-    private static class TrimmingDependencyNodeFilter implements DependencyNodeFilter
-    {
-        private DependencyNodeFilter dependencyNodeFilter;
-
-        public TrimmingDependencyNodeFilter( DependencyNodeFilter dependencyNodeFilter ) 
-        {
-            this.dependencyNodeFilter = dependencyNodeFilter;
-        }
-        
-        public boolean accept( DependencyNode node )
-        {
-            boolean accepted = dependencyNodeFilter.accept( node );
-            if( !accepted )
-            {
-                List<DependencyNode> children = node.getChildren();
-                children.clear();
-            }
-            return accepted;
-        }
-    }
-
     protected final void processInstructions( String header ) throws MojoExecutionException
     {
         Map<String,Attrs> instructions = OSGiHeader.parseHeader( MISSING_KEY_PATTERN.matcher( header ).replaceAll( "$1$2*;$3" ) );
@@ -297,40 +263,6 @@ public abstract class AbstractDependency
 
     private void filteredDependencies( final ArtifactFilter artifactFilter, Collection<Artifact> filteredDependencies )
     {
-        CollectingDependencyNodeVisitor collectingDependencyNodeVisitor = new CollectingDependencyNodeVisitor();
-        final Artifact rootArtifact = m_dependencyGraph.getArtifact();
-        ArtifactFilter filter = new ArtifactFilter()
-        {
-
-
-            public boolean include( Artifact artifact )
-            {
-                return artifact.equals( rootArtifact ) || artifactFilter.include( artifact );
-            }
-
-
-        };
-        DependencyNodeFilter dependencyNodeFilter = new ArtifactDependencyNodeFilter( filter );
-        dependencyNodeFilter = new TrimmingDependencyNodeFilter( dependencyNodeFilter );
-        DependencyNodeVisitor dependencyNodeVisitor =
-                new FilteringDependencyNodeVisitor( collectingDependencyNodeVisitor, dependencyNodeFilter );
-        dependencyNodeVisitor = new BuildingDependencyNodeVisitor( dependencyNodeVisitor );
-        m_dependencyGraph.accept( dependencyNodeVisitor );
-        List<DependencyNode> dependencyNodes = collectingDependencyNodeVisitor.getNodes();
-        Set<String> ids = new LinkedHashSet<String>( dependencyNodes.size() );
-        for( DependencyNode dependencyNode : dependencyNodes ) {
-            Artifact artifact = dependencyNode.getArtifact();
-            String id = artifact.getId();
-            ids.add(id);
-        }
-        for (Iterator<Artifact> iterator = filteredDependencies.iterator(); iterator.hasNext();)
-        {
-            Artifact artifact = iterator.next();
-            String id = artifact.getId();
-            if (!ids.contains(id))
-            {
-                iterator.remove();
-            }
-        }
+        filteredDependencies.removeIf( artifact -> !artifactFilter.include( artifact ) );
     }
 }

Modified: felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/AntPlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/AntPlugin.java?rev=1854549&r1=1854548&r2=1854549&view=diff
==============================================================================
--- felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/AntPlugin.java (original)
+++ felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/AntPlugin.java Thu Feb 28 21:15:15 2019
@@ -28,7 +28,6 @@ import java.util.Properties;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.project.MavenProject;
 import org.apache.maven.shared.dependency.graph.DependencyNode;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
@@ -50,7 +49,7 @@ public class AntPlugin extends BundlePlu
 
 
     @Override
-    protected void execute( MavenProject currentProject, DependencyNode dependencyGraph, Map<String, String> originalInstructions, Properties properties,
+    protected void execute( Map<String, String> originalInstructions,
         Jar[] classpath ) throws MojoExecutionException
     {
         final String artifactId = getProject().getArtifactId();
@@ -59,8 +58,8 @@ public class AntPlugin extends BundlePlu
         try
         {
             // assemble bundle as usual, but don't save it - this way we have all the instructions we need
-            Builder builder = buildOSGiBundle( currentProject,
-                    dependencyGraph, originalInstructions, properties, classpath );
+            Builder builder = buildOSGiBundle(project,
+                    originalInstructions, classpath );
             Properties bndProperties = builder.getProperties();
 
             // cleanup and remove all non-strings from the builder properties

Modified: felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java?rev=1854549&r1=1854548&r2=1854549&view=diff
==============================================================================
--- felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java (original)
+++ felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java Thu Feb 28 21:15:15 2019
@@ -28,7 +28,6 @@ import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
 import java.util.Set;
 import java.util.jar.Manifest;
 import java.util.regex.Matcher;
@@ -342,8 +341,7 @@ public class BundleAllPlugin extends Man
                 //                    + " to the same file, try cleaning: " + outputFile );
             }
 
-            org.apache.maven.shared.dependency.graph.DependencyNode dependencyGraph = buildDependencyGraph( project );
-            Analyzer analyzer = getAnalyzer( project, dependencyGraph, instructions, new Properties(), getClasspath( project, dependencyGraph ) );
+            Analyzer analyzer = getAnalyzer( project, instructions, getClasspath( project) );
 
             Jar osgiJar = new Jar( project.getArtifactId(), project.getArtifact().getFile() );
 

Modified: felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java?rev=1854549&r1=1854548&r2=1854549&view=diff
==============================================================================
--- felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java (original)
+++ felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java Thu Feb 28 21:15:15 2019
@@ -40,6 +40,7 @@ import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.Set;
 import java.util.TreeMap;
@@ -76,9 +77,6 @@ import org.apache.maven.project.MavenPro
 import org.apache.maven.project.MavenProjectBuilder;
 import org.apache.maven.project.MavenProjectHelper;
 import org.apache.maven.project.ProjectBuildingException;
-import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder;
-import org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException;
-import org.apache.maven.shared.dependency.graph.DependencyNode;
 import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder;
 import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException;
 import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
@@ -211,9 +209,6 @@ public class BundlePlugin extends Abstra
     @Component
     private ArtifactHandlerManager m_artifactHandlerManager;
 
-    @Component
-    protected DependencyGraphBuilder m_dependencyGraphBuilder;
-
     /* The current Maven session.  */
     @Parameter( defaultValue = "${session}", readonly = true )
     protected MavenSession session;
@@ -228,12 +223,6 @@ public class BundlePlugin extends Abstra
     @Component
     private DependencyTreeBuilder dependencyTreeBuilder;
 
-    /**
-     * The dependency graph builder to use.
-     */
-    @Component
-    protected DependencyGraphBuilder dependencyGraphBuilder;
-
     @Component
     private ArtifactMetadataSource artifactMetadataSource;
 
@@ -346,26 +335,11 @@ public class BundlePlugin extends Abstra
         return instructions;
     }
 
-    protected DependencyNode buildDependencyGraph( MavenProject mavenProject ) throws MojoExecutionException
-    {
-        DependencyNode dependencyGraph;
-        try
-        {
-            dependencyGraph = m_dependencyGraphBuilder.buildDependencyGraph( mavenProject, null );
-        }
-        catch ( DependencyGraphBuilderException e )
-        {
-            throw new MojoExecutionException( e.getMessage(), e );
-        }
-        return dependencyGraph;
-    }
-
     /**
      * @see org.apache.maven.plugin.AbstractMojo#execute()
      */
     public void execute() throws MojoExecutionException
     {
-        Properties properties = new Properties();
         String projectType = getProject().getArtifact().getType();
 
         // ignore unsupported project types, useful when bundleplugin is configured in parent pom
@@ -376,20 +350,13 @@ public class BundlePlugin extends Abstra
             return;
         }
 
-        execute( getProject(), buildDependencyGraph(getProject()), instructions, properties );
-    }
-
-
-    protected void execute( MavenProject currentProject, DependencyNode dependencyGraph, Map<String, String> originalInstructions, Properties properties )
-        throws MojoExecutionException
-    {
         try
         {
-            execute( currentProject, dependencyGraph, originalInstructions, properties, getClasspath( currentProject, dependencyGraph ) );
+            execute( instructions, getClasspath( project) );
         }
         catch ( IOException e )
         {
-            throw new MojoExecutionException( "Error calculating classpath for project " + currentProject, e );
+            throw new MojoExecutionException( "Error calculating classpath for project " + project, e );
         }
     }
 
@@ -398,10 +365,8 @@ public class BundlePlugin extends Abstra
     protected static Map<String, String> transformDirectives( Map<String, String> originalInstructions )
     {
         Map<String, String> transformedInstructions = new LinkedHashMap<String, String>();
-        for ( Iterator<Map.Entry<String, String>> i = originalInstructions.entrySet().iterator(); i.hasNext(); )
+        for ( Map.Entry<String, String> e : originalInstructions.entrySet() )
         {
-            Map.Entry<String, String> e = i.next();
-
             String key = e.getKey();
             if ( key.startsWith( "_" ) )
             {
@@ -435,17 +400,15 @@ public class BundlePlugin extends Abstra
         List<String> errors = analyzer.getErrors();
         List<String> warnings = analyzer.getWarnings();
 
-        for ( Iterator<String> w = warnings.iterator(); w.hasNext(); )
+        for ( String msg : warnings )
         {
-            String msg = w.next();
             getLog().warn( prefix + " : " + msg );
         }
 
         boolean hasErrors = false;
         String fileNotFound = "Input file does not exist: ";
-        for ( Iterator<String> e = errors.iterator(); e.hasNext(); )
+        for ( String msg : errors )
         {
-            String msg = e.next();
             if ( msg.startsWith(fileNotFound) && msg.endsWith( "~" ) )
             {
                 // treat as warning; this error happens when you have duplicate entries in Include-Resource
@@ -462,14 +425,14 @@ public class BundlePlugin extends Abstra
     }
 
 
-    protected void execute( MavenProject currentProject, DependencyNode dependencyGraph, Map<String, String> originalInstructions, Properties properties,
-        Jar[] classpath ) throws MojoExecutionException
+    protected void execute(Map<String, String> originalInstructions,
+                           Jar[] classpath) throws MojoExecutionException
     {
         try
         {
-            File jarFile = new File( getBuildDirectory(), getBundleName( currentProject ) );
-            Builder builder = buildOSGiBundle( currentProject, dependencyGraph, originalInstructions, properties, classpath );
-            boolean hasErrors = reportErrors( "Bundle " + currentProject.getArtifact(), builder );
+            File jarFile = new File( getBuildDirectory(), getBundleName( project ) );
+            Builder builder = buildOSGiBundle( project, originalInstructions, classpath );
+            boolean hasErrors = reportErrors( "Bundle " + project.getArtifact(), builder );
             if ( hasErrors )
             {
                 String failok = builder.getProperty( "-failok" );
@@ -485,7 +448,7 @@ public class BundlePlugin extends Abstra
             jarFile.getParentFile().mkdirs();
             builder.getJar().write( jarFile );
 
-            Artifact mainArtifact = currentProject.getArtifact();
+            Artifact mainArtifact = project.getArtifact();
 
             if ( "bundle".equals( mainArtifact.getType() ) )
             {
@@ -498,15 +461,15 @@ public class BundlePlugin extends Abstra
 
             if ( customClassifier && customPackaging )
             {
-                m_projectHelper.attachArtifact( currentProject, packaging, classifier, jarFile );
+                m_projectHelper.attachArtifact( project, packaging, classifier, jarFile );
             }
             else if ( customClassifier )
             {
-                m_projectHelper.attachArtifact( currentProject, jarFile, classifier );
+                m_projectHelper.attachArtifact( project, jarFile, classifier );
             }
             else if ( customPackaging )
             {
-                m_projectHelper.attachArtifact( currentProject, packaging, jarFile );
+                m_projectHelper.attachArtifact( project, packaging, jarFile );
             }
             else
             {
@@ -548,18 +511,17 @@ public class BundlePlugin extends Abstra
     }
 
 
-    protected Builder getOSGiBuilder( MavenProject currentProject, Map<String, String> originalInstructions, Properties properties,
+    protected Builder getOSGiBuilder( MavenProject currentProject, Map<String, String> originalInstructions,
         Jar[] classpath ) throws Exception
     {
+        Properties properties = new Properties();
         properties.putAll( getDefaultProperties( currentProject ) );
         properties.putAll( transformDirectives( originalInstructions ) );
 
         // process overrides from project
-        final Map<String, String> addProps = new HashMap<String, String>();
-        final Iterator<Map.Entry<Object, Object>> iter = currentProject.getProperties().entrySet().iterator();
-        while ( iter.hasNext() )
+        final Map<String, String> addProps = new HashMap<>();
+        for ( Entry<Object, Object> entry : currentProject.getProperties().entrySet() )
         {
-            final Map.Entry<Object, Object> entry = iter.next();
             final String key = entry.getKey().toString();
             if ( key.startsWith(BUNDLE_PLUGIN_EXTENSION) )
             {
@@ -589,10 +551,8 @@ public class BundlePlugin extends Abstra
             }
         }
         properties.putAll( addProps );
-        final Iterator<String> keyIter = addProps.keySet().iterator();
-        while ( keyIter.hasNext() )
+        for ( String key : addProps.keySet() )
         {
-            Object key = keyIter.next();
             properties.remove(BUNDLE_PLUGIN_EXTENSION + key);
             properties.remove(BUNDLE_PLUGIN_PREPEND_EXTENSION + key);
         }
@@ -606,7 +566,7 @@ public class BundlePlugin extends Abstra
         {
             String[] disabled = properties.remove("-disable-plugin").toString().replaceAll(" ", "").split(",");
             String[] enabled = properties.getProperty(Analyzer.PLUGIN, "").replaceAll(" ", "").split(",");
-            Set<String> plugin = new LinkedHashSet<String>();
+            Set<String> plugin = new LinkedHashSet<>();
             plugin.addAll(Arrays.asList(enabled));
             plugin.removeAll(Arrays.asList(disabled));
             StringBuilder sb = new StringBuilder();
@@ -643,7 +603,7 @@ public class BundlePlugin extends Abstra
         for ( Iterator<Map.Entry<Object,Object>> itr = properties.entrySet().iterator(); itr.hasNext(); )
         {
             Map.Entry<Object,Object> entry = itr.next();
-            if ( entry.getKey() instanceof String == false )
+            if ( !(entry.getKey() instanceof String) )
             {
                 String key = sanitize(entry.getKey());
                 if ( !properties.containsKey( key ) )
@@ -652,7 +612,7 @@ public class BundlePlugin extends Abstra
                 }
                 itr.remove();
             }
-            else if ( entry.getValue() instanceof String == false )
+            else if ( !(entry.getValue() instanceof String) )
             {
                 entry.setValue( sanitize( entry.getValue() ) );
             }
@@ -697,7 +657,7 @@ public class BundlePlugin extends Abstra
     }
 
 
-    protected void addMavenInstructions( MavenProject currentProject, DependencyNode dependencyGraph, Builder builder ) throws Exception
+    protected void addMavenInstructions(MavenProject currentProject, Builder builder) throws Exception
     {
         if ( currentProject.getBasedir() != null )
         {
@@ -715,8 +675,8 @@ public class BundlePlugin extends Abstra
         }
 
         // update BND instructions to embed selected Maven dependencies
-        Collection<Artifact> embeddableArtifacts = getEmbeddableArtifacts( currentProject, dependencyGraph, builder );
-        DependencyEmbedder dependencyEmbedder = new DependencyEmbedder(getLog(), dependencyGraph, embeddableArtifacts);
+        Collection<Artifact> embeddableArtifacts = getEmbeddableArtifacts( currentProject, builder );
+        DependencyEmbedder dependencyEmbedder = new DependencyEmbedder(getLog(), embeddableArtifacts);
         dependencyEmbedder.processHeaders(builder);
 
         Collection<Artifact> embeddedArtifacts = dependencyEmbedder.getEmbeddedArtifacts();
@@ -762,8 +722,7 @@ public class BundlePlugin extends Abstra
     // We need to find the direct dependencies that have been included in the uber JAR so that we can modify the
     // POM accordingly.
     private void createDependencyReducedPom( Set<String> artifactsToRemove )
-            throws IOException, DependencyTreeBuilderException, ProjectBuildingException
-    {
+            throws IOException, ProjectBuildingException, DependencyTreeBuilderException {
         Model model = project.getOriginalModel();
         List<Dependency> dependencies = new ArrayList<Dependency>();
 
@@ -771,10 +730,8 @@ public class BundlePlugin extends Abstra
 
         List<Dependency> transitiveDeps = new ArrayList<Dependency>();
 
-        for ( Iterator it = project.getArtifacts().iterator(); it.hasNext(); )
+        for ( Artifact artifact : project.getArtifacts() )
         {
-            Artifact artifact = (Artifact) it.next();
-
             if ( "pom".equals( artifact.getType() ) )
             {
                 // don't include pom type dependencies in dependency reduced pom
@@ -800,19 +757,17 @@ public class BundlePlugin extends Abstra
         }
         List<Dependency> origDeps = project.getDependencies();
 
-        for ( Iterator<Dependency> i = origDeps.iterator(); i.hasNext(); )
+        for (Dependency d : origDeps)
         {
-            Dependency d = i.next();
-
-            dependencies.add( d );
+            dependencies.add(d);
 
-            String id = getId( d );
+            String id = getId(d);
 
-            if ( artifactsToRemove.contains( id ) )
+            if (artifactsToRemove.contains(id))
             {
                 modified = true;
 
-                dependencies.remove( d );
+                dependencies.remove(d);
             }
         }
 
@@ -911,18 +866,14 @@ public class BundlePlugin extends Abstra
                 artifactMetadataSource, null,
                 artifactCollector);
         boolean modified = false;
-        Iterator it = node.getChildren().listIterator();
-        while ( it.hasNext() )
+        for (org.apache.maven.shared.dependency.tree.DependencyNode n2 : node.getChildren())
         {
-            org.apache.maven.shared.dependency.tree.DependencyNode n2 = (org.apache.maven.shared.dependency.tree.DependencyNode) it.next();
-            Iterator it2 = n2.getChildren().listIterator();
-            while ( it2.hasNext() )
+            for (org.apache.maven.shared.dependency.tree.DependencyNode n3 : n2.getChildren())
             {
-                org.apache.maven.shared.dependency.tree.DependencyNode n3 = (org.apache.maven.shared.dependency.tree.DependencyNode) it2.next();
                 //anything two levels deep that is marked "included"
                 //is stuff that was excluded by the original poms, make sure it
                 //remains excluded IF promoting transitives.
-                if ( n3.getState() == org.apache.maven.shared.dependency.tree.DependencyNode.INCLUDED )
+                if (n3.getState() == org.apache.maven.shared.dependency.tree.DependencyNode.INCLUDED)
                 {
                     //check if it really isn't in the list of original dependencies.  Maven
                     //prior to 2.0.8 may grab versions from transients instead of
@@ -931,29 +882,27 @@ public class BundlePlugin extends Abstra
 
                     //also, if not promoting the transitives, level 2's would be included
                     boolean found = false;
-                    for ( int x = 0; x < transitiveDeps.size(); x++ )
+                    for (Dependency dep : transitiveDeps)
                     {
-                        Dependency dep = transitiveDeps.get( x );
-                        if ( dep.getArtifactId().equals( n3.getArtifact().getArtifactId() ) && dep.getGroupId().equals(
-                                n3.getArtifact().getGroupId() ) )
+                        if (dep.getArtifactId().equals(n3.getArtifact().getArtifactId()) && dep.getGroupId().equals(
+                                n3.getArtifact().getGroupId()))
                         {
                             found = true;
                         }
 
                     }
 
-                    if ( !found )
+                    if (!found)
                     {
-                        for ( int x = 0; x < dependencies.size(); x++ )
+                        for (Dependency dep : dependencies)
                         {
-                            Dependency dep = dependencies.get( x );
-                            if ( dep.getArtifactId().equals( n2.getArtifact().getArtifactId() )
-                                    && dep.getGroupId().equals( n2.getArtifact().getGroupId() ) )
+                            if (dep.getArtifactId().equals(n2.getArtifact().getArtifactId())
+                                    && dep.getGroupId().equals(n2.getArtifact().getGroupId()))
                             {
                                 Exclusion exclusion = new Exclusion();
-                                exclusion.setArtifactId( n3.getArtifact().getArtifactId() );
-                                exclusion.setGroupId( n3.getArtifact().getGroupId() );
-                                dep.addExclusion( exclusion );
+                                exclusion.setArtifactId(n3.getArtifact().getArtifactId());
+                                exclusion.setGroupId(n3.getArtifact().getGroupId());
+                                dep.addExclusion(exclusion);
                                 modified = true;
                                 break;
                             }
@@ -966,16 +915,16 @@ public class BundlePlugin extends Abstra
     }
 
 
-    protected Builder buildOSGiBundle( MavenProject currentProject, DependencyNode dependencyGraph, Map<String, String> originalInstructions, Properties properties,
-        Jar[] classpath ) throws Exception
+    protected Builder buildOSGiBundle(MavenProject currentProject, Map<String, String> originalInstructions,
+                                      Jar[] classpath) throws Exception
     {
-        Builder builder = getOSGiBuilder( currentProject, originalInstructions, properties, classpath );
+        Builder builder = getOSGiBuilder( currentProject, originalInstructions, classpath );
 
-        addMavenInstructions( currentProject, dependencyGraph, builder );
+        addMavenInstructions( currentProject, builder );
 
         builder.build();
 
-        mergeMavenManifest(currentProject, dependencyGraph, builder);
+        mergeMavenManifest(currentProject, builder);
 
         return builder;
     }
@@ -1000,7 +949,7 @@ public class BundlePlugin extends Abstra
             ByteArrayOutputStream out = new ByteArrayOutputStream();
             stringProperties.store( out, null ); // properties encoding is 8859_1
             buf.append( out.toString( "8859_1" ) );
-            buf.append( "#-----------------------------------------------------------------------" + NL );
+            buf.append("#-----------------------------------------------------------------------").append(NL);
         }
         catch ( Throwable e )
         {
@@ -1014,17 +963,17 @@ public class BundlePlugin extends Abstra
     {
         try
         {
-            buf.append("#-----------------------------------------------------------------------" + NL);
-            buf.append( "-classpath:\\" + NL );
+            buf.append("#-----------------------------------------------------------------------").append(NL);
+            buf.append("-classpath:\\").append(NL);
             for ( Iterator<Jar> i = classpath.iterator(); i.hasNext(); )
             {
                 File path = i.next().getSource();
                 if ( path != null )
                 {
-                    buf.append( ' ' + path.toString() + ( i.hasNext() ? ",\\" : "" ) + NL );
+                    buf.append(' ').append(path.toString()).append(i.hasNext() ? ",\\" : "").append(NL);
                 }
             }
-            buf.append( "#-----------------------------------------------------------------------" + NL );
+            buf.append("#-----------------------------------------------------------------------").append(NL);
         }
         catch ( Throwable e )
         {
@@ -1038,11 +987,11 @@ public class BundlePlugin extends Abstra
     {
         try
         {
-            buf.append( "#-----------------------------------------------------------------------" + NL );
+            buf.append("#-----------------------------------------------------------------------").append(NL);
             ByteArrayOutputStream out = new ByteArrayOutputStream();
             ManifestWriter.outputManifest(manifest, out, true); // manifest encoding is UTF8
             buf.append( out.toString( "UTF8" ) );
-            buf.append( "#-----------------------------------------------------------------------" + NL );
+            buf.append("#-----------------------------------------------------------------------").append(NL);
         }
         catch ( Throwable e )
         {
@@ -1086,7 +1035,7 @@ public class BundlePlugin extends Abstra
     }
 
 
-    protected void mergeMavenManifest( MavenProject currentProject, DependencyNode dependencyGraph, Builder builder ) throws Exception
+    protected void mergeMavenManifest(MavenProject currentProject, Builder builder) throws Exception
     {
         Jar jar = builder.getJar();
 
@@ -1190,7 +1139,7 @@ public class BundlePlugin extends Abstra
             String importPackages = bundleManifest.getMainAttributes().getValue( "Import-Package" );
             if ( importPackages != null )
             {
-                Set optionalPackages = getOptionalPackages( currentProject, dependencyGraph );
+                Set optionalPackages = getOptionalPackages( currentProject);
 
                 Map<String, ? extends Map<String, String>> values;
                 try (Analyzer analyzer = new Analyzer()) {
@@ -1411,10 +1360,10 @@ public class BundlePlugin extends Abstra
     }
 
 
-    protected Set<String> getOptionalPackages( MavenProject currentProject, DependencyNode dependencyGraph ) throws IOException, MojoExecutionException
+    protected Set<String> getOptionalPackages(MavenProject currentProject) throws IOException, MojoExecutionException
     {
         ArrayList<Artifact> inscope = new ArrayList<Artifact>();
-        final Collection<Artifact> artifacts = getSelectedDependencies( dependencyGraph, currentProject.getArtifacts() );
+        final Collection<Artifact> artifacts = getSelectedDependencies(currentProject.getArtifacts() );
         for ( Iterator<Artifact> it = artifacts.iterator(); it.hasNext(); )
         {
             Artifact artifact = it.next();
@@ -1625,27 +1574,27 @@ public class BundlePlugin extends Abstra
     }
 
 
-    protected Jar[] getClasspath( MavenProject currentProject, DependencyNode dependencyGraph ) throws IOException, MojoExecutionException
+    protected Jar[] getClasspath(MavenProject currentProject) throws IOException, MojoExecutionException
     {
-        List<Jar> list = new ArrayList<Jar>();
+        List<Jar> list = new ArrayList<Jar>( currentProject.getArtifacts().size() + 1 );
 
-        if ( getOutputDirectory() != null && getOutputDirectory().exists() )
+        String d = currentProject.getBuild() != null ? currentProject.getBuild().getOutputDirectory() : null;
+        if ( d != null )
         {
-            list.add( new Jar( ".", getOutputDirectory() ) );
+            list.add( new Jar( ".", d ) );
         }
 
-        final Collection<Artifact> artifacts = getSelectedDependencies( dependencyGraph, currentProject.getArtifacts() );
-        for ( Iterator<Artifact> it = artifacts.iterator(); it.hasNext(); )
+        final Collection<Artifact> artifacts = getSelectedDependencies(currentProject.getArtifacts() );
+        for ( Artifact artifact : artifacts  )
         {
-            Artifact artifact = it.next();
             if ( artifact.getArtifactHandler().isAddedToClasspath() && !Artifact.SCOPE_TEST.equals( artifact.getScope() ) )
             {
                 File file = getFile( artifact );
                 if ( file == null )
                 {
                     getLog().warn(
-                        "File is not available for artifact " + artifact + " in project "
-                            + currentProject.getArtifact() );
+                            "File is not available for artifact " + artifact + " in project "
+                                    + currentProject.getArtifact() );
                     continue;
                 }
                 Jar jar = new Jar( artifact.getArtifactId(), file );
@@ -1654,11 +1603,12 @@ public class BundlePlugin extends Abstra
         }
         Jar[] cp = new Jar[list.size()];
         list.toArray( cp );
+
         return cp;
     }
 
 
-    private Collection<Artifact> getSelectedDependencies( DependencyNode dependencyGraph, Collection<Artifact> artifacts ) throws MojoExecutionException
+    private Collection<Artifact> getSelectedDependencies(Collection<Artifact> artifacts) throws MojoExecutionException
     {
         if ( null == excludeDependencies || excludeDependencies.length() == 0 )
         {
@@ -1670,7 +1620,7 @@ public class BundlePlugin extends Abstra
         }
 
         Collection<Artifact> selectedDependencies = new LinkedHashSet<Artifact>( artifacts );
-        DependencyExcluder excluder = new DependencyExcluder( dependencyGraph, artifacts );
+        DependencyExcluder excluder = new DependencyExcluder(artifacts );
         excluder.processHeaders( excludeDependencies );
         selectedDependencies.removeAll( excluder.getExcludedArtifacts() );
 
@@ -2084,13 +2034,13 @@ public class BundlePlugin extends Abstra
     }
 
 
-    protected Collection<Artifact> getEmbeddableArtifacts( MavenProject currentProject, DependencyNode dependencyGraph, Analyzer analyzer )
+    protected Collection<Artifact> getEmbeddableArtifacts(MavenProject currentProject, Analyzer analyzer)
         throws MojoExecutionException
     {
         final Collection<Artifact> artifacts;
 
         String embedTransitive = analyzer.getProperty( DependencyEmbedder.EMBED_TRANSITIVE );
-        if ( Boolean.valueOf( embedTransitive ).booleanValue() )
+        if (Boolean.valueOf(embedTransitive))
         {
             // includes transitive dependencies
             artifacts = currentProject.getArtifacts();
@@ -2101,7 +2051,7 @@ public class BundlePlugin extends Abstra
             artifacts = currentProject.getDependencyArtifacts();
         }
 
-        return getSelectedDependencies( dependencyGraph, artifacts );
+        return getSelectedDependencies(artifacts );
     }
 
 

Modified: felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java
URL: http://svn.apache.org/viewvc/felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java?rev=1854549&r1=1854548&r2=1854549&view=diff
==============================================================================
--- felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java (original)
+++ felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java Thu Feb 28 21:15:15 2019
@@ -64,9 +64,9 @@ public final class DependencyEmbedder ex
     private final Collection<Artifact> m_embeddedArtifacts;
 
 
-    public DependencyEmbedder( Log log, DependencyNode dependencyGraph, Collection<Artifact> dependencyArtifacts )
+    public DependencyEmbedder( Log log, Collection<Artifact> dependencyArtifacts )
     {
-        super( dependencyGraph, dependencyArtifacts );
+        super( dependencyArtifacts );
 
         m_inlinedPaths = new LinkedHashSet<String>();
         m_embeddedArtifacts = new LinkedHashSet<Artifact>();

Modified: felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/DependencyExcluder.java
URL: http://svn.apache.org/viewvc/felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/DependencyExcluder.java?rev=1854549&r1=1854548&r2=1854549&view=diff
==============================================================================
--- felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/DependencyExcluder.java (original)
+++ felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/DependencyExcluder.java Thu Feb 28 21:15:15 2019
@@ -40,9 +40,9 @@ public final class DependencyExcluder ex
     private final Collection<Artifact> m_excludedArtifacts;
 
 
-    public DependencyExcluder( DependencyNode dependencyGraph, Collection<Artifact> dependencyArtifacts )
+    public DependencyExcluder( Collection<Artifact> dependencyArtifacts )
     {
-        super( dependencyGraph, dependencyArtifacts );
+        super( dependencyArtifacts );
 
         m_excludedArtifacts = new HashSet<Artifact>();
     }

Modified: felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/InstructionsPlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/InstructionsPlugin.java?rev=1854549&r1=1854548&r2=1854549&view=diff
==============================================================================
--- felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/InstructionsPlugin.java (original)
+++ felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/InstructionsPlugin.java Thu Feb 28 21:15:15 2019
@@ -23,13 +23,11 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.Map;
-import java.util.Properties;
 
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.project.MavenProject;
 
 import aQute.bnd.osgi.Jar;
 import org.apache.maven.shared.dependency.graph.DependencyNode;
@@ -42,7 +40,7 @@ import org.apache.maven.shared.dependenc
 public class InstructionsPlugin extends BundlePlugin
 {
     @Override
-    protected void execute( MavenProject project, DependencyNode dependencyGraph, Map<String, String> instructions, Properties properties, Jar[] classpath )
+    protected void execute( Map<String, String> instructions, Jar[] classpath )
         throws MojoExecutionException
     {
         if ( dumpInstructions == null )
@@ -52,7 +50,7 @@ public class InstructionsPlugin extends
 
         try
         {
-            addMavenInstructions( project, dependencyGraph, getOSGiBuilder(project, instructions, properties, classpath) );
+            addMavenInstructions( project, getOSGiBuilder(project, instructions, classpath) );
         }
         catch ( FileNotFoundException e )
         {

Modified: felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java?rev=1854549&r1=1854548&r2=1854549&view=diff
==============================================================================
--- felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java (original)
+++ felix/trunk/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java Thu Feb 28 21:15:15 2019
@@ -31,10 +31,6 @@ import java.nio.charset.StandardCharsets
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.nio.file.attribute.FileTime;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -42,7 +38,6 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.Set;
-import java.util.TreeSet;
 import java.util.jar.Manifest;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -65,7 +60,6 @@ import org.apache.maven.plugins.annotati
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.shared.dependency.graph.DependencyNode;
 import org.codehaus.plexus.util.Scanner;
 import org.osgi.service.metatype.MetaTypeService;
 import org.sonatype.plexus.build.incremental.BuildContext;
@@ -97,7 +91,7 @@ public class ManifestPlugin extends Bund
     private BuildContext buildContext;
 
     @Override
-    protected void execute( MavenProject project, DependencyNode dependencyGraph, Map<String, String> instructions, Properties properties, Jar[] classpath )
+    protected void execute( Map<String, String> instructions, Jar[] classpath )
         throws MojoExecutionException
     {
 
@@ -114,7 +108,7 @@ public class ManifestPlugin extends Bund
         Analyzer analyzer;
         try
         {
-            analyzer = getAnalyzer(project, dependencyGraph, instructions, properties, classpath);
+            analyzer = getAnalyzer(project, instructions, classpath);
 
             if (supportIncrementalBuild) {
                 writeIncrementalInfo(project);
@@ -186,17 +180,17 @@ public class ManifestPlugin extends Bund
         return scanner.getIncludedFiles().length > 0;
     }
 
-    public Manifest getManifest( MavenProject project, DependencyNode dependencyGraph, Jar[] classpath ) throws IOException, MojoFailureException,
+    public Manifest getManifest( MavenProject project, Jar[] classpath ) throws IOException, MojoFailureException,
         MojoExecutionException, Exception
     {
-        return getManifest( project, dependencyGraph, new LinkedHashMap<String, String>(), new Properties(), classpath, buildContext );
+        return getManifest( project, new LinkedHashMap<String, String>(), classpath, buildContext );
     }
 
 
-    public Manifest getManifest( MavenProject project, DependencyNode dependencyGraph, Map<String, String> instructions, Properties properties, Jar[] classpath,
-            BuildContext buildContext) throws IOException, MojoFailureException, MojoExecutionException, Exception
+    public Manifest getManifest( MavenProject project, Map<String, String> instructions, Jar[] classpath,
+            BuildContext buildContext ) throws IOException, MojoFailureException, MojoExecutionException, Exception
     {
-        Analyzer analyzer = getAnalyzer(project, dependencyGraph, instructions, properties, classpath);
+        Analyzer analyzer = getAnalyzer(project, instructions, classpath);
 
         Jar jar = analyzer.getJar();
         Manifest manifest = jar.getManifest();
@@ -255,19 +249,19 @@ public class ManifestPlugin extends Bund
         }
     }
 
-    protected Analyzer getAnalyzer( MavenProject project, DependencyNode dependencyGraph, Jar[] classpath ) throws IOException, MojoExecutionException,
+    protected Analyzer getAnalyzer( MavenProject project, Jar[] classpath ) throws IOException, MojoExecutionException,
         Exception
     {
-        return getAnalyzer( project, dependencyGraph, new LinkedHashMap<String, String>(), new Properties(), classpath );
+        return getAnalyzer( project, new LinkedHashMap<>(), classpath );
     }
 
 
-    protected Analyzer getAnalyzer( MavenProject project, DependencyNode dependencyGraph, Map<String, String> instructions, Properties properties, Jar[] classpath )
+    protected Analyzer getAnalyzer( MavenProject project, Map<String, String> instructions, Jar[] classpath )
         throws IOException, MojoExecutionException, Exception
     {
         if ( rebuildBundle && supportedProjectTypes.contains( project.getArtifact().getType() ) )
         {
-            return buildOSGiBundle( project, dependencyGraph, instructions, properties, classpath );
+            return buildOSGiBundle( project, instructions, classpath );
         }
 
         File file = getOutputDirectory();
@@ -288,7 +282,7 @@ public class ManifestPlugin extends Bund
             }
         }
 
-        Builder analyzer = getOSGiBuilder( project, instructions, properties, classpath );
+        Builder analyzer = getOSGiBuilder( project, instructions, classpath );
 
         analyzer.setJar( file );
 
@@ -306,7 +300,7 @@ public class ManifestPlugin extends Bund
             analyzer.setProperty( Analyzer.EXPORT_PACKAGE, export );
         }
 
-        addMavenInstructions( project, dependencyGraph, analyzer );
+        addMavenInstructions( project, analyzer );
 
         // if we spot Embed-Dependency and the bundle is "target/classes", assume we need to rebuild
         if ( analyzer.getProperty( DependencyEmbedder.EMBED_DEPENDENCY ) != null && isOutputDirectory )
@@ -319,7 +313,7 @@ public class ManifestPlugin extends Bund
             analyzer.getJar().setManifest( analyzer.calcManifest() );
         }
 
-        mergeMavenManifest( project, dependencyGraph, analyzer );
+        mergeMavenManifest( project, analyzer );
 
         boolean hasErrors = reportErrors( "Manifest " + project.getArtifact(), analyzer );
         if ( hasErrors )

Modified: felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/AbstractBundlePluginTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/AbstractBundlePluginTest.java?rev=1854549&r1=1854548&r2=1854549&view=diff
==============================================================================
--- felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/AbstractBundlePluginTest.java (original)
+++ felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/AbstractBundlePluginTest.java Thu Feb 28 21:15:15 2019
@@ -29,13 +29,13 @@ import org.apache.maven.artifact.handler
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.DefaultArtifactRepository;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.maven.artifact.repository.layout.LegacyRepositoryLayout;
+import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.plugin.testing.stubs.ArtifactStub;
 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
-import org.apache.maven.project.DefaultProjectBuilderConfiguration;
-import org.apache.maven.project.ProjectBuilderConfiguration;
+import org.apache.maven.project.DefaultProjectBuildingRequest;
+import org.apache.maven.project.ProjectBuildingRequest;
 
 
 /**
@@ -61,11 +61,11 @@ public abstract class AbstractBundlePlug
                                  versionRange, null, "pom", null, artifactHandler );
         artifact.setResolved( true );
         project.setArtifact( artifact );
-        ProjectBuilderConfiguration projectBuilderConfiguration = new DefaultProjectBuilderConfiguration();
-        ArtifactRepositoryLayout layout = new LegacyRepositoryLayout();
+        ProjectBuildingRequest projectBuilderConfiguration = new DefaultProjectBuildingRequest();
+        ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
         ArtifactRepository artifactRepository = new DefaultArtifactRepository( "scratch", new File( getBasedir(), "target" + File.separatorChar + "scratch" ).toURI().toString(), layout );
         projectBuilderConfiguration.setLocalRepository( artifactRepository );
-        project.setProjectBuilderConfiguration( projectBuilderConfiguration );
+        project.setProjectBuildingRequest( projectBuilderConfiguration );
         return project;
     }
 

Modified: felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BlueprintComponentTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BlueprintComponentTest.java?rev=1854549&r1=1854548&r2=1854549&view=diff
==============================================================================
--- felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BlueprintComponentTest.java (original)
+++ felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BlueprintComponentTest.java Thu Feb 28 21:15:15 2019
@@ -38,8 +38,8 @@ import org.apache.maven.artifact.version
 import org.apache.maven.model.Resource;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
-import org.apache.maven.project.DefaultProjectBuilderConfiguration;
-import org.apache.maven.project.ProjectBuilderConfiguration;
+import org.apache.maven.project.DefaultProjectBuildingRequest;
+import org.apache.maven.project.ProjectBuildingRequest;
 import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder;
 import org.apache.maven.shared.dependency.graph.DependencyNode;
 import org.osgi.framework.Constants;
@@ -99,9 +99,9 @@ public class BlueprintComponentTest exte
         Artifact artifact = new DefaultArtifact(project.getGroupId(),project.getArtifactId(),versionRange, null, "jar", null, artifactHandler);
         project.setArtifact(artifact);
 
-        ProjectBuilderConfiguration projectBuilderConfiguration = new DefaultProjectBuilderConfiguration();
+        ProjectBuildingRequest projectBuilderConfiguration = new DefaultProjectBuildingRequest();
         projectBuilderConfiguration.setLocalRepository(null);
-        project.setProjectBuilderConfiguration(projectBuilderConfiguration);
+        project.setProjectBuildingRequest(projectBuilderConfiguration);
 
         Resource r = new Resource();
         r.setDirectory( new File( "src/test/resources" ).getAbsoluteFile().getCanonicalPath() );
@@ -112,7 +112,6 @@ public class BlueprintComponentTest exte
         ManifestPlugin plugin = new ManifestPlugin();
         plugin.setBuildDirectory( "target/tmp/basedir/target" );
         plugin.setOutputDirectory(new File("target/tmp/basedir/target/classes"));
-        setVariableValueToObject(plugin, "m_dependencyGraphBuilder", lookup(DependencyGraphBuilder.class.getName(), "default"));
 
         Map instructions = new HashMap();
         instructions.put( "service_mode", mode );
@@ -125,8 +124,7 @@ public class BlueprintComponentTest exte
         instructions.put( "Import-Service", "org.osgi.service.cm.ConfigurationAdmin;availability:=optional" );
 
         Properties props = new Properties();
-        DependencyNode dependencyGraph = plugin.buildDependencyGraph(project);
-        Builder builder = plugin.buildOSGiBundle( project, dependencyGraph, instructions, props, plugin.getClasspath( project, dependencyGraph ) );
+        Builder builder = plugin.buildOSGiBundle( project, instructions, plugin.getClasspath( project) );
 
         Manifest manifest = builder.getJar().getManifest();
         String impSvc = manifest.getMainAttributes().getValue( Constants.IMPORT_SERVICE );

Modified: felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java?rev=1854549&r1=1854548&r2=1854549&view=diff
==============================================================================
--- felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java (original)
+++ felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java Thu Feb 28 21:15:15 2019
@@ -61,7 +61,6 @@ public class BundleAllPluginTest extends
         plugin.setBuildDirectory( buildDirectory.getPath() );
         File outputDirectory = new File( buildDirectory, "test-classes" );
         plugin.setOutputDirectory( outputDirectory );
-        setVariableValueToObject(plugin, "m_dependencyGraphBuilder", lookup(DependencyGraphBuilder.class.getName(), "default"));
     }
 
 

Modified: felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java?rev=1854549&r1=1854548&r2=1854549&view=diff
==============================================================================
--- felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java (original)
+++ felix/trunk/tools/maven-bundle-plugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java Thu Feb 28 21:15:15 2019
@@ -34,7 +34,6 @@ import java.util.jar.Manifest;
 import org.apache.maven.model.Organization;
 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder;
 import org.apache.maven.shared.dependency.graph.DependencyNode;
 import org.osgi.framework.Constants;
 
@@ -61,7 +60,6 @@ public class BundlePluginTest extends Ab
         plugin = new BundlePlugin();
         plugin.setBuildDirectory( "." );
         plugin.setOutputDirectory(new File(getBasedir(), "target" + File.separatorChar + "scratch"));
-        setVariableValueToObject(plugin, "m_dependencyGraphBuilder", lookup(DependencyGraphBuilder.class.getName(), "default"));
     }
 
 
@@ -236,8 +234,7 @@ public class BundlePluginTest extends Ab
             + "*;classifier=;type=jar;scope=runtime" );
         Properties props = new Properties();
 
-        DependencyNode dependencyGraph = plugin.buildDependencyGraph(project);
-        Builder builder = plugin.buildOSGiBundle( project, dependencyGraph, instructions, props, plugin.getClasspath( project, dependencyGraph ) );
+        Builder builder = plugin.buildOSGiBundle( project, instructions, plugin.getClasspath( project) );
         Manifest manifest = builder.getJar().getManifest();
 
         String bcp = manifest.getMainAttributes().getValue( Constants.BUNDLE_CLASSPATH );
@@ -264,10 +261,8 @@ public class BundlePluginTest extends Ab
 
         Map instructions = new HashMap();
         instructions.put( DependencyEmbedder.EMBED_DEPENDENCY, "!type=jar, !artifactId=c" );
-        Properties props = new Properties();
 
-        DependencyNode dependencyGraph = plugin.buildDependencyGraph(project);
-        Builder builder = plugin.buildOSGiBundle( project, dependencyGraph, instructions, props, plugin.getClasspath( project, dependencyGraph ) );
+        Builder builder = plugin.buildOSGiBundle( project, instructions, plugin.getClasspath( project) );
         Manifest manifest = builder.getJar().getManifest();
 
         String bcp = manifest.getMainAttributes().getValue( Constants.BUNDLE_CLASSPATH );
@@ -296,8 +291,7 @@ public class BundlePluginTest extends Ab
         instructions.put( DependencyEmbedder.EMBED_DEPENDENCY, "c;type=jar,c;type=sources" );
         Properties props = new Properties();
 
-        DependencyNode dependencyGraph = plugin.buildDependencyGraph(project);
-        Builder builder = plugin.buildOSGiBundle( project, dependencyGraph, instructions, props, plugin.getClasspath( project, dependencyGraph ) );
+        Builder builder = plugin.buildOSGiBundle( project, instructions, plugin.getClasspath( project) );
         Manifest manifest = builder.getJar().getManifest();
 
         String bcp = manifest.getMainAttributes().getValue( Constants.BUNDLE_CLASSPATH );
@@ -326,8 +320,7 @@ public class BundlePluginTest extends Ab
         instructions.put( DependencyEmbedder.EMBED_DEPENDENCY, "artifactId=a|b" );
         Properties props = new Properties();
 
-        DependencyNode dependencyGraph = plugin.buildDependencyGraph(project);
-        Builder builder = plugin.buildOSGiBundle( project, dependencyGraph, instructions, props, plugin.getClasspath( project, dependencyGraph ) );
+        Builder builder = plugin.buildOSGiBundle( project, instructions, plugin.getClasspath( project) );
         Manifest manifest = builder.getJar().getManifest();
 
         String bcp = manifest.getMainAttributes().getValue( Constants.BUNDLE_CLASSPATH );
@@ -353,17 +346,16 @@ public class BundlePluginTest extends Ab
         MavenProject project = getMavenProjectStub();
         project.setDependencyArtifacts(artifacts);
         Properties props = new Properties();
-        DependencyNode dependencyGraph = plugin.buildDependencyGraph(project);
-        Jar[] classpath = plugin.getClasspath(project, dependencyGraph);
+        Jar[] classpath = plugin.getClasspath(project);
 
         Map instructions1 = new HashMap();
         instructions1.put( DependencyEmbedder.EMBED_DEPENDENCY, "!scope=compile" );
-        Builder builder1 = plugin.buildOSGiBundle( project, dependencyGraph, instructions1, props, classpath );
+        Builder builder1 = plugin.buildOSGiBundle( project, instructions1, classpath );
         Manifest manifest1 = builder1.getJar().getManifest();
 
         Map instructions2 = new HashMap();
         instructions2.put( DependencyEmbedder.EMBED_DEPENDENCY, "scope=!compile" );
-        Builder builder2 = plugin.buildOSGiBundle( project, dependencyGraph, instructions2, props, classpath );
+        Builder builder2 = plugin.buildOSGiBundle( project, instructions2, classpath );
         Manifest manifest2 = builder2.getJar().getManifest();
 
         String bcp1 = manifest1.getMainAttributes().getValue( Constants.BUNDLE_CLASSPATH );
@@ -386,7 +378,7 @@ public class BundlePluginTest extends Ab
     {
         MavenProject project = getMavenProjectStub();
 
-        Properties props = new Properties();
+        Properties props = project.getProperties();
 
         props.put( new File( "A" ), new File( "B" ) );
         props.put( new int[4], new HashMap( 2 ) );
@@ -396,8 +388,7 @@ public class BundlePluginTest extends Ab
         props.put( "4", new HashMap( 2 ) );
         props.put( "1, two, 3.0", new char[5] );
 
-        DependencyNode dependencyGraph = plugin.buildDependencyGraph(project);
-        Builder builder = plugin.getOSGiBuilder( project, new HashMap(), props, plugin.getClasspath( project, dependencyGraph ) );
+        Builder builder = plugin.getOSGiBuilder( project, new HashMap(), plugin.getClasspath( project) );
 
         File file = new File( getBasedir(), "target" + File.separatorChar + "test.props" );
         builder.getProperties().store( new FileOutputStream( file ), "TEST" );



Mime
View raw message