You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2022/02/24 16:04:46 UTC

[maven-archiver] branch mvn4 updated: Switch a few core plugins to the new api

This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch mvn4
in repository https://gitbox.apache.org/repos/asf/maven-archiver.git


The following commit(s) were added to refs/heads/mvn4 by this push:
     new 36d08bb  Switch a few core plugins to the new api
36d08bb is described below

commit 36d08bbd975a4966d480ce0eb3d726638c3df848
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Thu Feb 24 17:00:58 2022 +0100

    Switch a few core plugins to the new api
---
 pom.xml                                            |   5 +
 .../org/apache/maven/archiver/MavenArchiver.java   | 354 +++++++++------------
 .../apache/maven/archiver/PomPropertiesUtil.java   |  16 +-
 .../apache/maven/archiver/MavenArchiverTest.java   | 325 ++++++++++---------
 .../org/apache/maven/archiver/MockArtifact.java    | 268 +++-------------
 .../java/org/apache/maven/archiver/MockNode.java   | 113 +++++++
 .../org/apache/maven/archiver/MockProject.java     | 121 +++++++
 .../apache/maven/archiver/MockProjectManager.java  | 111 +++++++
 .../org/apache/maven/archiver/MockSession.java     | 139 ++++++++
 9 files changed, 850 insertions(+), 602 deletions(-)

diff --git a/pom.xml b/pom.xml
index 28c64e3..172c6c8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,6 +74,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
+      <artifactId>maven-core-api</artifactId>
+      <version>${mavenVersion}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
       <artifactId>maven-core</artifactId>
       <version>${mavenVersion}</version>
     </dependency>
diff --git a/src/main/java/org/apache/maven/archiver/MavenArchiver.java b/src/main/java/org/apache/maven/archiver/MavenArchiver.java
index 5ece688..79fc66a 100644
--- a/src/main/java/org/apache/maven/archiver/MavenArchiver.java
+++ b/src/main/java/org/apache/maven/archiver/MavenArchiver.java
@@ -19,12 +19,14 @@ package org.apache.maven.archiver;
  * under the License.
  */
 
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.DependencyResolutionRequiredException;
+import org.apache.maven.api.Artifact;
+import org.apache.maven.api.Node;
+import org.apache.maven.api.Project;
+import org.apache.maven.api.plugin.annotations.ResolutionScope;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.services.ProjectManager;
 import org.apache.maven.artifact.versioning.ArtifactVersion;
-import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.project.MavenProject;
+import org.apache.maven.artifact.versioning.VersionRange;
 import org.codehaus.plexus.archiver.jar.JarArchiver;
 import org.codehaus.plexus.archiver.jar.Manifest;
 import org.codehaus.plexus.archiver.jar.ManifestException;
@@ -50,9 +52,10 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Properties;
-import java.util.Set;
 import java.util.jar.Attributes;
+import java.util.stream.Collectors;
 
 import static org.apache.maven.archiver.ManifestConfiguration.CLASSPATH_LAYOUT_TYPE_CUSTOM;
 import static org.apache.maven.archiver.ManifestConfiguration.CLASSPATH_LAYOUT_TYPE_REPOSITORY;
@@ -122,10 +125,9 @@ public class MavenArchiver
      * @param config the MavenArchiveConfiguration
      * @return the {@link Manifest}
      * @throws ManifestException in case of a failure
-     * @throws DependencyResolutionRequiredException resolution failure
      */
-    public Manifest getManifest( MavenSession session, MavenProject project, MavenArchiveConfiguration config )
-        throws ManifestException, DependencyResolutionRequiredException
+    public Manifest getManifest( Session session, Project project, MavenArchiveConfiguration config )
+        throws ManifestException
     {
         boolean hasManifestEntries = !config.isManifestEntriesEmpty();
         Map<String, String> entries =
@@ -187,31 +189,29 @@ public class MavenArchiver
     /**
      * Return a pre-configured manifest.
      *
-     * @param project {@link MavenProject}
+     * @param project {@link Project}
      * @param config {@link ManifestConfiguration}
      * @return {@link Manifest}
      * @throws ManifestException Manifest exception.
-     * @throws DependencyResolutionRequiredException Dependency resolution exception.
      */
     // TODO Add user attributes list and user groups list
-    public Manifest getManifest( MavenProject project, ManifestConfiguration config )
-        throws ManifestException, DependencyResolutionRequiredException
+    public Manifest getManifest( Project project, ManifestConfiguration config )
+        throws ManifestException
     {
-        return getManifest( null, project, config, Collections.<String, String>emptyMap() );
+        return getManifest( null, project, config, Collections.emptyMap() );
     }
 
     /**
-     * @param mavenSession {@link MavenSession}
-     * @param project {@link MavenProject}
+     * @param Session {@link Session}
+     * @param project {@link Project}
      * @param config {@link ManifestConfiguration}
      * @return {@link Manifest}
      * @throws ManifestException the manifest exception
-     * @throws DependencyResolutionRequiredException the dependency resolution required exception
      */
-    public Manifest getManifest( MavenSession mavenSession, MavenProject project, ManifestConfiguration config )
-        throws ManifestException, DependencyResolutionRequiredException
+    public Manifest getManifest( Session session, Project project, ManifestConfiguration config )
+        throws ManifestException
     {
-        return getManifest( mavenSession, project, config, Collections.<String, String>emptyMap() );
+        return getManifest( session, project, config, Collections.emptyMap() );
     }
 
     private void addManifestAttribute( Manifest manifest, Map<String, String> map, String key, String value )
@@ -242,17 +242,16 @@ public class MavenArchiver
     }
 
     /**
-     * @param session {@link MavenSession}
-     * @param project {@link MavenProject}
+     * @param session {@link Session}
+     * @param project {@link Project}
      * @param config {@link ManifestConfiguration}
      * @param entries The entries.
      * @return {@link Manifest}
      * @throws ManifestException the manifest exception
-     * @throws DependencyResolutionRequiredException the dependency resolution required exception
      */
-    protected Manifest getManifest( MavenSession session, MavenProject project, ManifestConfiguration config,
+    protected Manifest getManifest( Session session, Project project, ManifestConfiguration config,
                                     Map<String, String> entries )
-                                        throws ManifestException, DependencyResolutionRequiredException
+                                        throws ManifestException
     {
         // TODO: Should we replace "map" with a copy? Note, that we modify it!
 
@@ -273,108 +272,103 @@ public class MavenArchiver
         {
             StringBuilder classpath = new StringBuilder();
 
-            List<String> artifacts = project.getRuntimeClasspathElements();
+            List<Artifact> artifacts = session.getService( ProjectManager.class )
+                    .getResolvedDependencies( project, ProjectManager.ResolutionScope.CompileRuntime );
             String classpathPrefix = config.getClasspathPrefix();
             String layoutType = config.getClasspathLayoutType();
             String layout = config.getCustomClasspathLayout();
 
             Interpolator interpolator = new StringSearchInterpolator();
 
-            for ( String artifactFile : artifacts )
+            for ( Artifact artifact : artifacts )
             {
-                File f = new File( artifactFile );
-                if ( f.getAbsoluteFile().isFile() )
+                if ( classpath.length() > 0 )
                 {
-                    Artifact artifact = findArtifactWithFile( project.getArtifacts(), f );
+                    classpath.append( " " );
+                }
+                classpath.append( classpathPrefix );
 
-                    if ( classpath.length() > 0 )
-                    {
-                        classpath.append( " " );
-                    }
-                    classpath.append( classpathPrefix );
+                // NOTE: If the artifact or layout type (from config) is null, give up and use the file name by
+                // itself.
+                if ( layoutType == null )
+                {
+                    classpath.append( artifact.getPath().get().getFileName().toString() );
+                }
+                else
+                {
+                    List<ValueSource> valueSources = new ArrayList<>();
+
+                    handleExtraExpression( artifact, valueSources );
 
-                    // NOTE: If the artifact or layout type (from config) is null, give up and use the file name by
-                    // itself.
-                    if ( artifact == null || layoutType == null )
+                    for ( ValueSource vs : valueSources )
                     {
-                        classpath.append( f.getName() );
+                        interpolator.addValueSource( vs );
                     }
-                    else
-                    {
-                        List<ValueSource> valueSources = new ArrayList<>();
 
-                        handleExtraExpression( artifact, valueSources );
+                    RecursionInterceptor recursionInterceptor =
+                        new PrefixAwareRecursionInterceptor( ARTIFACT_EXPRESSION_PREFIXES );
 
-                        for ( ValueSource vs : valueSources )
-                        {
-                            interpolator.addValueSource( vs );
-                        }
-
-                        RecursionInterceptor recursionInterceptor =
-                            new PrefixAwareRecursionInterceptor( ARTIFACT_EXPRESSION_PREFIXES );
-
-                        try
+                    try
+                    {
+                        switch ( layoutType )
                         {
-                            switch ( layoutType )
-                            {
-                                case CLASSPATH_LAYOUT_TYPE_SIMPLE:
-                                    if ( config.isUseUniqueVersions() )
-                                    {
-                                        classpath.append( interpolator.interpolate( SIMPLE_LAYOUT,
-                                                recursionInterceptor ) );
-                                    }
-                                    else
-                                    {
-                                        classpath.append( interpolator.interpolate( SIMPLE_LAYOUT_NONUNIQUE,
-                                                recursionInterceptor ) );
-                                    }
-                                    break;
-                                case CLASSPATH_LAYOUT_TYPE_REPOSITORY:
-                                    // we use layout /$groupId[0]/../${groupId[n]/$artifactId/$version/{fileName}
-                                    // here we must find the Artifact in the project Artifacts
-                                    // to create the maven layout
-                                    if ( config.isUseUniqueVersions() )
-                                    {
-                                        classpath.append( interpolator.interpolate( REPOSITORY_LAYOUT,
-                                                recursionInterceptor ) );
-                                    }
-                                    else
-                                    {
-                                        classpath.append( interpolator.interpolate( REPOSITORY_LAYOUT_NONUNIQUE,
-                                                recursionInterceptor ) );
-                                    }
-                                    break;
-                                case CLASSPATH_LAYOUT_TYPE_CUSTOM:
-                                    if ( layout == null )
-                                    {
-                                        throw new ManifestException( CLASSPATH_LAYOUT_TYPE_CUSTOM
-                                                + " layout type was declared, but custom layout expression was not"
-                                                + " specified. Check your <archive><manifest><customLayout/>"
-                                                + " element." );
-                                    }
-
-                                    classpath.append( interpolator.interpolate( layout, recursionInterceptor ) );
-                                    break;
-                                default:
-                                    throw new ManifestException( "Unknown classpath layout type: '" + layoutType
-                                            + "'. Check your <archive><manifest><layoutType/> element." );
-                            }
+                            case CLASSPATH_LAYOUT_TYPE_SIMPLE:
+                                if ( config.isUseUniqueVersions() )
+                                {
+                                    classpath.append( interpolator.interpolate( SIMPLE_LAYOUT,
+                                            recursionInterceptor ) );
+                                }
+                                else
+                                {
+                                    classpath.append( interpolator.interpolate( SIMPLE_LAYOUT_NONUNIQUE,
+                                            recursionInterceptor ) );
+                                }
+                                break;
+                            case CLASSPATH_LAYOUT_TYPE_REPOSITORY:
+                                // we use layout /$groupId[0]/../${groupId[n]/$artifactId/$version/{fileName}
+                                // here we must find the Artifact in the project Artifacts
+                                // to create the maven layout
+                                if ( config.isUseUniqueVersions() )
+                                {
+                                    classpath.append( interpolator.interpolate( REPOSITORY_LAYOUT,
+                                            recursionInterceptor ) );
+                                }
+                                else
+                                {
+                                    classpath.append( interpolator.interpolate( REPOSITORY_LAYOUT_NONUNIQUE,
+                                            recursionInterceptor ) );
+                                }
+                                break;
+                            case CLASSPATH_LAYOUT_TYPE_CUSTOM:
+                                if ( layout == null )
+                                {
+                                    throw new ManifestException( CLASSPATH_LAYOUT_TYPE_CUSTOM
+                                            + " layout type was declared, but custom layout expression was not"
+                                            + " specified. Check your <archive><manifest><customLayout/>"
+                                            + " element." );
+                                }
+
+                                classpath.append( interpolator.interpolate( layout, recursionInterceptor ) );
+                                break;
+                            default:
+                                throw new ManifestException( "Unknown classpath layout type: '" + layoutType
+                                        + "'. Check your <archive><manifest><layoutType/> element." );
                         }
-                        catch ( InterpolationException e )
-                        {
-                            ManifestException error =
-                                new ManifestException( "Error interpolating artifact path for classpath entry: "
-                                    + e.getMessage() );
+                    }
+                    catch ( InterpolationException e )
+                    {
+                        ManifestException error =
+                            new ManifestException( "Error interpolating artifact path for classpath entry: "
+                                + e.getMessage() );
 
-                            error.initCause( e );
-                            throw error;
-                        }
-                        finally
+                        error.initCause( e );
+                        throw error;
+                    }
+                    finally
+                    {
+                        for ( ValueSource vs : valueSources )
                         {
-                            for ( ValueSource vs : valueSources )
-                            {
-                                interpolator.removeValuesSource( vs );
-                            }
+                            interpolator.removeValuesSource( vs );
                         }
                     }
                 }
@@ -406,7 +400,7 @@ public class MavenArchiver
 
         if ( config.isAddExtensions() )
         {
-            handleExtensions( project, entries, m );
+            handleExtensions( session, project, entries, m );
         }
 
         addCustomEntries( m, entries, config );
@@ -418,8 +412,8 @@ public class MavenArchiver
     {
         valueSources.add( new PrefixedObjectValueSource( ARTIFACT_EXPRESSION_PREFIXES, artifact,
                                                          true ) );
-        valueSources.add( new PrefixedObjectValueSource( ARTIFACT_EXPRESSION_PREFIXES,
-                                                         artifact.getArtifactHandler(), true ) );
+        //valueSources.add( new PrefixedObjectValueSource( ARTIFACT_EXPRESSION_PREFIXES,
+        //                                                 artifact.getArtifactHandler(), true ) );
 
         Properties extraExpressions = new Properties();
         // FIXME: This query method SHOULD NOT affect the internal
@@ -444,88 +438,75 @@ public class MavenArchiver
                                                              extraExpressions, true ) );
     }
 
-    private void handleExtensions( MavenProject project, Map<String, String> entries, Manifest m )
+    private void handleExtensions( Session session, Project project, Map<String, String> entries, Manifest m )
         throws ManifestException
     {
         // TODO: this is only for applets - should we distinguish them as a packaging?
-        StringBuilder extensionsList = new StringBuilder();
-        Set<Artifact> artifacts = project.getArtifacts();
+        Node root = session.getService( ProjectManager.class )
+                .getCollectedDependencies( project, ProjectManager.ResolutionScope.Test );
 
-        for ( Artifact artifact : artifacts )
-        {
-            if ( !Artifact.SCOPE_TEST.equals( artifact.getScope() ) )
-            {
-                if ( "jar".equals( artifact.getType() ) )
-                {
-                    if ( extensionsList.length() > 0 )
-                    {
-                        extensionsList.append( " " );
-                    }
-                    extensionsList.append( artifact.getArtifactId() );
-                }
-            }
-        }
+        List<Node> extensions = root.stream()
+                .filter( n -> !Objects.equals( n.getDependency().getScope(), ResolutionScope.TEST.id() ) )
+                .filter( n -> "jar".equals( n.getArtifact().getExtension() ) )
+                .collect( Collectors.toList() );
 
-        if ( extensionsList.length() > 0 )
-        {
-            addManifestAttribute( m, entries, "Extension-List", extensionsList.toString() );
-        }
 
-        for ( Object artifact1 : artifacts )
+        if ( !extensions.isEmpty() )
         {
-            // TODO: the correct solution here would be to have an extension type, and to read
-            // the real extension values either from the artifact's manifest or some part of the POM
-            Artifact artifact = (Artifact) artifact1;
-            if ( "jar".equals( artifact.getType() ) )
+            String list = extensions.stream()
+                    .map( n -> n.getArtifact().getArtifactId() )
+                    .collect( Collectors.joining( " " ) );
+            addManifestAttribute( m, entries, "Extension-List", list );
+
+            for ( Node extension : extensions )
             {
+                Artifact artifact = extension.getArtifact();
                 String artifactId = artifact.getArtifactId().replace( '.', '_' );
                 String ename = artifactId + "-Extension-Name";
                 addManifestAttribute( m, entries, ename, artifact.getArtifactId() );
                 String iname = artifactId + "-Implementation-Version";
                 addManifestAttribute( m, entries, iname, artifact.getVersion() );
 
-                if ( artifact.getRepository() != null )
+                if ( extension.getRepository().isPresent() )
                 {
                     iname = artifactId + "-Implementation-URL";
-                    String url = artifact.getRepository().getUrl() + "/" + artifact.toString();
+                    String url = extension.getRepository().get().getUrl() + "/" + artifact;
                     addManifestAttribute( m, entries, iname, url );
                 }
             }
         }
     }
 
-    private void handleImplementationEntries( MavenProject project, Map<String, String> entries, Manifest m )
+    private void handleImplementationEntries( Project project, Map<String, String> entries, Manifest m )
         throws ManifestException
     {
-        addManifestAttribute( m, entries, "Implementation-Title", project.getName() );
+        addManifestAttribute( m, entries, "Implementation-Title", project.getModel().getName() );
         addManifestAttribute( m, entries, "Implementation-Version", project.getVersion() );
 
-        if ( project.getOrganization() != null )
+        if ( project.getModel().getOrganization() != null )
         {
-            addManifestAttribute( m, entries, "Implementation-Vendor", project.getOrganization().getName() );
+            addManifestAttribute( m, entries, "Implementation-Vendor", project.getModel().getOrganization().getName() );
         }
     }
 
-    private void handleSpecificationEntries( MavenProject project, Map<String, String> entries, Manifest m )
+    private void handleSpecificationEntries( Project project, Map<String, String> entries, Manifest m )
         throws ManifestException
     {
-        addManifestAttribute( m, entries, "Specification-Title", project.getName() );
+        addManifestAttribute( m, entries, "Specification-Title", project.getModel().getName() );
 
-        try
-        {
-            ArtifactVersion version = project.getArtifact().getSelectedVersion();
-            String specVersion = String.format( "%s.%s", version.getMajorVersion(), version.getMinorVersion() );
-            addManifestAttribute( m, entries, "Specification-Version", specVersion );
-        }
-        catch ( OverConstrainedVersionException e )
+        ArtifactVersion version = VersionRange.createFromVersion( project.getArtifact().getVersion() )
+                .getRecommendedVersion();
+        if ( version == null )
         {
             throw new ManifestException( "Failed to get selected artifact version to calculate"
-                + " the specification version: " + e.getMessage() );
+                    + " the specification version: " + project.getArtifact().getVersion() );
         }
+        String specVersion = String.format( "%s.%s", version.getMajorVersion(), version.getMinorVersion() );
+        addManifestAttribute( m, entries, "Specification-Version", specVersion );
 
-        if ( project.getOrganization() != null )
+        if ( project.getModel().getOrganization() != null )
         {
-            addManifestAttribute( m, entries, "Specification-Vendor", project.getOrganization().getName() );
+            addManifestAttribute( m, entries, "Specification-Vendor", project.getModel().getOrganization().getName() );
         }
     }
 
@@ -568,23 +549,17 @@ public class MavenArchiver
     }
 
     /**
-     * @param session {@link MavenSession}
-     * @param project {@link MavenProject}
+     * @param session {@link Session}
+     * @param project {@link Project}
      * @param archiveConfiguration {@link MavenArchiveConfiguration}
      * @throws org.codehaus.plexus.archiver.ArchiverException Archiver Exception.
      * @throws ManifestException Manifest Exception.
      * @throws IOException IO Exception.
-     * @throws DependencyResolutionRequiredException Dependency resolution exception.
      */
-    public void createArchive( MavenSession session, MavenProject project,
+    public void createArchive( Session session, Project project,
                                MavenArchiveConfiguration archiveConfiguration )
-                                   throws ManifestException, IOException,
-                                   DependencyResolutionRequiredException
+                                   throws ManifestException, IOException
     {
-        // we have to clone the project instance so we can write out the pom with the deployment version,
-        // without impacting the main project instance...
-        MavenProject workingProject = project.clone();
-
         boolean forced = archiveConfiguration.isForced();
         if ( archiveConfiguration.isAddMavenDescriptor() )
         {
@@ -599,27 +574,23 @@ public class MavenArchiver
             // POM information without the use of maven tools can do so.
             // ----------------------------------------------------------------------
 
-            if ( workingProject.getArtifact().isSnapshot() )
-            {
-                workingProject.setVersion( workingProject.getArtifact().getVersion() );
-            }
+            String groupId = project.getGroupId();
 
-            String groupId = workingProject.getGroupId();
+            String artifactId = project.getArtifactId();
 
-            String artifactId = workingProject.getArtifactId();
-
-            archiver.addFile( project.getFile(), "META-INF/maven/" + groupId + "/" + artifactId + "/pom.xml" );
+            archiver.addFile( project.getPomPath().toFile(), "META-INF/maven/"
+                    + groupId + "/" + artifactId + "/pom.xml" );
 
             // ----------------------------------------------------------------------
             // Create pom.properties file
             // ----------------------------------------------------------------------
 
             File customPomPropertiesFile = archiveConfiguration.getPomPropertiesFile();
-            File dir = new File( workingProject.getBuild().getDirectory(), "maven-archiver" );
+            File dir = new File( project.getModel().getBuild().getDirectory(), "maven-archiver" );
             File pomPropertiesFile = new File( dir, "pom.properties" );
 
-            new PomPropertiesUtil().createPomProperties( session, workingProject, archiver,
-                customPomPropertiesFile, pomPropertiesFile, forced );
+            new PomPropertiesUtil().createPomProperties( groupId, artifactId, project.getArtifact().getVersion(),
+                    archiver, customPomPropertiesFile, pomPropertiesFile, forced );
         }
 
         // ----------------------------------------------------------------------
@@ -635,7 +606,7 @@ public class MavenArchiver
             archiver.setManifest( manifestFile );
         }
 
-        Manifest manifest = getManifest( session, workingProject, archiveConfiguration );
+        Manifest manifest = getManifest( session, project, archiveConfiguration );
 
         // Configure the jar
         archiver.addConfiguredManifest( manifest );
@@ -651,11 +622,12 @@ public class MavenArchiver
         // make the archiver index the jars on the classpath, if we are adding that to the manifest
         if ( archiveConfiguration.getManifest().isAddClasspath() )
         {
-            List<String> artifacts = project.getRuntimeClasspathElements();
-            for ( String artifact : artifacts )
+
+            List<Artifact> artifacts = session.getService( ProjectManager.class )
+                    .getResolvedDependencies( project, ProjectManager.ResolutionScope.Runtime );
+            for ( Artifact artifact : artifacts )
             {
-                File f = new File( artifact );
-                archiver.addConfiguredIndexJars( f );
+                archiver.addConfiguredIndexJars( artifact.getPath().get().toFile() );
             }
         }
 
@@ -695,7 +667,7 @@ public class MavenArchiver
          }
     }
 
-    private void handleBuildEnvironmentEntries( MavenSession session, Manifest m, Map<String, String> entries )
+    private void handleBuildEnvironmentEntries( Session session, Manifest m, Map<String, String> entries )
         throws ManifestException
     {
         addManifestAttribute( m, entries, "Build-Tool",
@@ -706,22 +678,6 @@ public class MavenArchiver
             System.getProperty( "os.version" ), System.getProperty( "os.arch" ) ) );
     }
 
-    private Artifact findArtifactWithFile( Set<Artifact> artifacts, File file )
-    {
-        for ( Artifact artifact : artifacts )
-        {
-            // normally not null but we can check
-            if ( artifact.getFile() != null )
-            {
-                if ( artifact.getFile().equals( file ) )
-                {
-                    return artifact;
-                }
-            }
-        }
-        return null;
-    }
-
     private static String getCreatedByVersion( String groupId, String artifactId )
     {
         final Properties properties = PropertyUtils.loadOptionalProperties( MavenArchiver.class.getResourceAsStream(
diff --git a/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java b/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java
index 7da8883..4f33c4a 100644
--- a/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java
+++ b/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java
@@ -32,8 +32,6 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
 
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.archiver.Archiver;
 
 /**
@@ -107,8 +105,9 @@ public class PomPropertiesUtil
 
     /**
      * Creates the pom.properties file.
-     * @param session {@link MavenSession}
-     * @param project {@link MavenProject}
+     * @param groupId the project groupId
+     * @param artifactId the project artifactId
+     * @param version the project version
      * @param archiver {@link Archiver}
      * @param customPomPropertiesFile optional custom pom properties file
      * @param pomPropertiesFile The pom properties file.
@@ -116,14 +115,11 @@ public class PomPropertiesUtil
      * @throws org.codehaus.plexus.archiver.ArchiverException archiver exception.
      * @throws IOException IO exception.
      */
-    public void createPomProperties( MavenSession session, MavenProject project, Archiver archiver,
-                                     File customPomPropertiesFile, File pomPropertiesFile, boolean forceCreation )
+    public void createPomProperties( String groupId, String artifactId, String version,
+                                     Archiver archiver, File customPomPropertiesFile, File pomPropertiesFile,
+                                     boolean forceCreation )
         throws IOException
     {
-        final String groupId = project.getGroupId();
-        final String artifactId = project.getArtifactId();
-        final String version = project.getVersion();
-
         Properties p;
 
         if ( customPomPropertiesFile != null )
diff --git a/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java b/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java
index 029d3fb..37777d1 100644
--- a/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java
+++ b/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java
@@ -19,20 +19,19 @@ package org.apache.maven.archiver;
  * under the License.
  */
 
-import org.apache.maven.artifact.Artifact;
+import org.apache.maven.api.Node;
+import org.apache.maven.api.Project;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.Artifact;
 import org.apache.maven.artifact.DependencyResolutionRequiredException;
 import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.handler.DefaultArtifactHandler;
-import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.execution.DefaultMavenExecutionRequest;
 import org.apache.maven.execution.DefaultMavenExecutionResult;
 import org.apache.maven.execution.MavenExecutionRequest;
 import org.apache.maven.execution.MavenExecutionResult;
-import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Build;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Organization;
-import org.apache.maven.project.MavenProject;
 import org.apache.maven.shared.utils.StringUtils;
 import org.apache.maven.shared.utils.io.FileUtils;
 import org.codehaus.plexus.archiver.jar.JarArchiver;
@@ -46,7 +45,9 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
 import java.net.URL;
+import java.nio.file.Path;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Date;
@@ -54,11 +55,13 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-import java.util.Set;
+import java.util.SortedSet;
 import java.util.TreeSet;
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 import java.util.zip.ZipEntry;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -66,6 +69,8 @@ import static org.junit.Assert.*;
 
 public class MavenArchiverTest
 {
+    private MockProjectManager mockProjectManager = new MockProjectManager();
+
     static class ArtifactComparator
         implements Comparator<Artifact>
     {
@@ -110,15 +115,15 @@ public class MavenArchiverTest
     {
         MavenArchiver archiver = new MavenArchiver();
 
-        MavenSession session = getDummySession();
+        Session session = getDummySession();
 
         Model model = new Model();
         model.setArtifactId( "dummy" );
 
-        MavenProject project = new MavenProject( model );
+        MockProject project = new MockProject( model );
+
         // we need to sort the artifacts for test purposes
-        Set<Artifact> artifacts = new TreeSet<>( new ArtifactComparator() );
-        project.setArtifacts( artifacts );
+        SortedSet<Node> artifacts = new TreeSet<>( Comparator.comparing( n -> n.getArtifact().getArtifactId() ) );
 
         // there should be a mock or a setter for this field.
         ManifestConfiguration config = new ManifestConfiguration()
@@ -129,6 +134,8 @@ public class MavenArchiverTest
             }
         };
 
+        mockProjectManager.setResolvedDependencies( artifacts );
+
         Manifest manifest = archiver.getManifest( session, project, config );
 
         assertThat( manifest.getMainAttributes() ).isNotNull();
@@ -139,10 +146,10 @@ public class MavenArchiverTest
         artifact1.setGroupId( "org.apache.dummy" );
         artifact1.setArtifactId( "dummy1" );
         artifact1.setVersion( "1.0" );
-        artifact1.setType( "dll" );
-        artifact1.setScope( "compile" );
+        artifact1.setExtension( "dll" );
+        artifacts.add( new MockNode( artifact1, "compile" ) );
 
-        artifacts.add( artifact1 );
+        mockProjectManager.setResolvedDependencies( artifacts );
 
         manifest = archiver.getManifest( session, project, config );
 
@@ -152,10 +159,10 @@ public class MavenArchiverTest
         artifact2.setGroupId( "org.apache.dummy" );
         artifact2.setArtifactId( "dummy2" );
         artifact2.setVersion( "1.0" );
-        artifact2.setType( "jar" );
-        artifact2.setScope( "compile" );
+        artifact2.setExtension( "jar" );
+        artifacts.add( new MockNode( artifact2, "compile" ) );
 
-        artifacts.add( artifact2 );
+        mockProjectManager.setResolvedDependencies( artifacts );
 
         manifest = archiver.getManifest( session, project, config );
 
@@ -165,10 +172,10 @@ public class MavenArchiverTest
         artifact3.setGroupId( "org.apache.dummy" );
         artifact3.setArtifactId( "dummy3" );
         artifact3.setVersion( "1.0" );
-        artifact3.setScope( "test" );
-        artifact3.setType( "jar" );
+        artifact3.setExtension( "jar" );
+        artifacts.add( new MockNode( artifact3, "test" ) );
 
-        artifacts.add( artifact3 );
+        mockProjectManager.setResolvedDependencies( artifacts );
 
         manifest = archiver.getManifest( session, project, config );
 
@@ -178,10 +185,10 @@ public class MavenArchiverTest
         artifact4.setGroupId( "org.apache.dummy" );
         artifact4.setArtifactId( "dummy4" );
         artifact4.setVersion( "1.0" );
-        artifact4.setType( "jar" );
-        artifact4.setScope( "compile" );
+        artifact4.setExtension( "jar" );
+        artifacts.add( new MockNode( artifact4, "compile" ) );
 
-        artifacts.add( artifact4 );
+        mockProjectManager.setResolvedDependencies( artifacts );
 
         manifest = archiver.getManifest( session, project, config );
 
@@ -193,23 +200,25 @@ public class MavenArchiverTest
         throws Exception
     {
         final File tempFile = File.createTempFile( "maven-archiver-test-", ".jar" );
+        MockArtifact mockArtifact = new MockArtifact();
+        mockArtifact.setGroupId( "myGroupId" );
+        mockArtifact.setArtifactId( "maven-archiver-test" );
+        mockArtifact.setVersion( "SNAPSHOT" );
+        mockArtifact.setExtension( "jar" );
+        mockArtifact.setPath( tempFile.toPath() );
 
         try
         {
             MavenArchiver archiver = new MavenArchiver();
 
-            MavenSession session = getDummySession();
+            Session session = getDummySession();
 
             Model model = new Model();
             model.setArtifactId( "dummy" );
 
-            MavenProject project = new MavenProject( model )
-            {
-                public List<String> getRuntimeClasspathElements()
-                {
-                    return Collections.singletonList( tempFile.getAbsolutePath() );
-                }
-            };
+            MockProject project = new MockProject( model );
+            mockProjectManager.setResolvedDependencies( Collections.singleton(
+                    new MockNode( mockArtifact, "compile" ) ) );
 
             // there should be a mock or a setter for this field.
             ManifestConfiguration manifestConfig = new ManifestConfiguration()
@@ -248,8 +257,8 @@ public class MavenArchiverTest
 
         MavenArchiver archiver = getMavenArchiver( jarArchiver );
 
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        Project project = getDummyProject();
 
         MavenArchiveConfiguration config = new MavenArchiveConfiguration();
         config.setForced( false );
@@ -286,8 +295,8 @@ public class MavenArchiverTest
 
         MavenArchiver archiver = getMavenArchiver( jarArchiver );
 
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        MockProject project = getDummyProject();
 
         MavenArchiveConfiguration config = new MavenArchiveConfiguration();
         config.setForced( true );
@@ -311,15 +320,14 @@ public class MavenArchiverTest
 
         MavenArchiver archiver = getMavenArchiver( jarArchiver );
 
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        MockProject project = getDummyProject();
 
         String ls = System.getProperty( "line.separator" );
-        project.setDescription( "foo " + ls + " bar " );
         MavenArchiveConfiguration config = new MavenArchiveConfiguration();
         config.setForced( true );
         config.getManifest().setAddDefaultImplementationEntries( true );
-        config.addManifestEntry( "Description", project.getDescription() );
+        config.addManifestEntry( "Description", "foo " + ls + " bar " );
         archiver.createArchive( session, project, config );
         assertThat( jarFile ).exists();
 
@@ -348,13 +356,13 @@ public class MavenArchiverTest
 
         MavenArchiver archiver = getMavenArchiver( jarArchiver );
 
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        Project project = getDummyProject();
 
-        Set<Artifact> artifacts =
+        List<Node> artifacts =
             getArtifacts( getMockArtifact1(), getArtifactWithDot(), getMockArtifact2(), getMockArtifact3() );
 
-        project.setArtifacts( artifacts );
+        mockProjectManager.setResolvedDependencies( artifacts );
 
         MavenArchiveConfiguration config = new MavenArchiveConfiguration();
         config.setForced( false );
@@ -377,13 +385,13 @@ public class MavenArchiverTest
         JarArchiver jarArchiver = getCleanJarArchiver( jarFile );
         MavenArchiver archiver = getMavenArchiver( jarArchiver );
 
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        Project project = getDummyProject();
 
-        Set<Artifact> artifacts =
+        List<Node> artifacts =
             getArtifacts( getMockArtifact1(), getArtifactWithDot(), getMockArtifact2(), getMockArtifact3() );
 
-        project.setArtifacts( artifacts );
+        mockProjectManager.setResolvedDependencies( artifacts );
 
         MavenArchiveConfiguration config = new MavenArchiveConfiguration();
         config.setForced( false );
@@ -412,15 +420,14 @@ public class MavenArchiverTest
 
         MavenArchiver archiver = getMavenArchiver( jarArchiver );
 
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        Project project = getDummyProject();
 
         String ls = System.getProperty( "line.separator" );
-        project.setDescription( "foo " + ls + " bar " );
         MavenArchiveConfiguration config = new MavenArchiveConfiguration();
         config.setForced( true );
         config.getManifest().setAddDefaultImplementationEntries( true );
-        config.addManifestEntry( "Description", project.getDescription() );
+        config.addManifestEntry( "Description", "foo " + ls + " bar " );
         // config.addManifestEntry( "EntryWithTab", " foo tab " + ( '\u0009' ) + ( '\u0009' ) // + " bar tab" + ( //
         // '\u0009' // ) );
         archiver.createArchive( session, project, config );
@@ -428,7 +435,6 @@ public class MavenArchiverTest
 
         final Manifest manifest = getJarFileManifest( jarFile );
         Attributes attributes = manifest.getMainAttributes();
-        assertThat( project.getDescription().indexOf( ls ) ).isGreaterThan( 0 );
         Attributes.Name description = new Attributes.Name( "Description" );
         String value = attributes.getValue( description );
         assertThat( value ).isNotNull();
@@ -444,13 +450,13 @@ public class MavenArchiverTest
 
         MavenArchiver archiver = getMavenArchiver( jarArchiver );
 
-        MavenProject project = getDummyProject();
+        Project project = getDummyProject();
         MavenArchiveConfiguration config = new MavenArchiveConfiguration();
         config.setForced( true );
         config.getManifest().setAddDefaultImplementationEntries( true );
         config.getManifest().setAddDefaultSpecificationEntries( true );
 
-        MavenSession session = getDummySessionWithoutMavenVersion();
+        Session session = getDummySessionWithoutMavenVersion();
         archiver.createArchive( session, project, config );
         assertThat( jarFile ).exists();
         Attributes manifest = getJarFileManifest( jarFile ).getMainAttributes();
@@ -477,8 +483,8 @@ public class MavenArchiverTest
 
         MavenArchiver archiver = getMavenArchiver( jarArchiver );
 
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        Project project = getDummyProject();
         MavenArchiveConfiguration config = new MavenArchiveConfiguration();
         config.setForced( true );
         config.getManifest().setAddDefaultEntries( false );
@@ -503,8 +509,8 @@ public class MavenArchiverTest
 
         MavenArchiver archiver = getMavenArchiver( jarArchiver );
 
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        Project project = getDummyProject();
         MavenArchiveConfiguration config = new MavenArchiveConfiguration();
         config.setForced( true );
         config.getManifest().setAddDefaultImplementationEntries( true );
@@ -573,8 +579,8 @@ public class MavenArchiverTest
 
         MavenArchiver archiver = getMavenArchiver( jarArchiver );
 
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        Project project = getDummyProject();
         MavenArchiveConfiguration config = new MavenArchiveConfiguration();
 
         Map<String, String> manifestEntries = new HashMap<>();
@@ -600,9 +606,9 @@ public class MavenArchiverTest
     {
         MavenArchiver archiver = new MavenArchiver();
 
-        MavenSession session = getDummySession();
+        Session session = getDummySession();
 
-        MavenProject project = getDummyProject();
+        Project project = getDummyProject();
         MavenArchiveConfiguration config = new MavenArchiveConfiguration();
 
         ManifestSection manifestSection = new ManifestSection();
@@ -627,8 +633,8 @@ public class MavenArchiverTest
     public void testDefaultClassPathValue()
         throws Exception
     {
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        Project project = getDummyProject();
         File jarFile = new File( "target/test/dummy.jar" );
         JarArchiver jarArchiver = getCleanJarArchiver( jarFile );
 
@@ -661,8 +667,8 @@ public class MavenArchiverTest
     public void testDefaultClassPathValue_WithSnapshot()
         throws Exception
     {
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProjectWithSnapshot();
+        Session session = getDummySession();
+        Project project = getDummyProjectWithSnapshot();
         File jarFile = new File( "target/test/dummy.jar" );
         JarArchiver jarArchiver = getCleanJarArchiver( jarFile );
 
@@ -690,8 +696,8 @@ public class MavenArchiverTest
     public void testMavenRepoClassPathValue()
         throws Exception
     {
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        Project project = getDummyProject();
         File jarFile = new File( "target/test/dummy.jar" );
         JarArchiver jarArchiver = getCleanJarArchiver( jarFile );
 
@@ -727,8 +733,8 @@ public class MavenArchiverTest
     public void shouldCreateArchiveWithSimpleClassPathLayoutWhileSettingSimpleLayoutExplicit()
         throws Exception
     {
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        Project project = getDummyProject();
         File jarFile = new File( "target/test/dummy-explicit-simple.jar" );
         JarArchiver jarArchiver = getCleanJarArchiver( jarFile );
 
@@ -762,8 +768,8 @@ public class MavenArchiverTest
     public void shouldCreateArchiveCustomerLayoutSimple()
         throws Exception
     {
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        Project project = getDummyProject();
         File jarFile = new File( "target/test/dummy-custom-layout-simple.jar" );
         JarArchiver jarArchiver = getCleanJarArchiver( jarFile );
 
@@ -798,8 +804,8 @@ public class MavenArchiverTest
     public void shouldCreateArchiveCustomLayoutSimpleNonUnique()
         throws Exception
     {
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        Project project = getDummyProject();
         File jarFile = new File( "target/test/dummy-custom-layout-simple-non-unique.jar" );
         JarArchiver jarArchiver = getCleanJarArchiver( jarFile );
 
@@ -834,8 +840,8 @@ public class MavenArchiverTest
     public void shouldCreateArchiveCustomLayoutRepository()
         throws Exception
     {
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        Project project = getDummyProject();
         File jarFile = new File( "target/test/dummy-custom-layout-repo.jar" );
         JarArchiver jarArchiver = getCleanJarArchiver( jarFile );
 
@@ -874,8 +880,8 @@ public class MavenArchiverTest
     public void shouldCreateArchiveCustomLayoutRepositoryNonUnique()
         throws Exception
     {
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        Project project = getDummyProject();
         File jarFile = new File( "target/test/dummy-custom-layout-repo-non-unique.jar" );
         JarArchiver jarArchiver = getCleanJarArchiver( jarFile );
 
@@ -914,8 +920,8 @@ public class MavenArchiverTest
     public void shouldCreateArchiveWithSimpleClassPathLayoutUsingDefaults()
         throws Exception
     {
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        Project project = getDummyProject();
         File jarFile = new File( "target/test/dummy-defaults.jar" );
         JarArchiver jarArchiver = getCleanJarArchiver( jarFile );
 
@@ -947,8 +953,8 @@ public class MavenArchiverTest
     public void testMavenRepoClassPathValue_WithSnapshot()
         throws Exception
     {
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProjectWithSnapshot();
+        Session session = getDummySession();
+        Project project = getDummyProjectWithSnapshot();
         File jarFile = new File( "target/test/dummy.jar" );
         JarArchiver jarArchiver = getCleanJarArchiver( jarFile );
 
@@ -984,8 +990,8 @@ public class MavenArchiverTest
     public void testCustomClassPathValue()
         throws Exception
     {
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        Project project = getDummyProject();
         File jarFile = new File( "target/test/dummy.jar" );
         JarArchiver jarArchiver = getCleanJarArchiver( jarFile );
 
@@ -1022,8 +1028,8 @@ public class MavenArchiverTest
     public void testCustomClassPathValue_WithSnapshotResolvedVersion()
         throws Exception
     {
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProjectWithSnapshot();
+        Session session = getDummySession();
+        Project project = getDummyProjectWithSnapshot();
         File jarFile = new File( "target/test/dummy.jar" );
         JarArchiver jarArchiver = getCleanJarArchiver( jarFile );
         MavenArchiver archiver = getMavenArchiver( jarArchiver );
@@ -1059,8 +1065,8 @@ public class MavenArchiverTest
     public void testCustomClassPathValue_WithSnapshotForcingBaseVersion()
         throws Exception
     {
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProjectWithSnapshot();
+        Session session = getDummySession();
+        Project project = getDummyProjectWithSnapshot();
         File jarFile = new File( "target/test/dummy.jar" );
         JarArchiver jarArchiver = getCleanJarArchiver( jarFile );
 
@@ -1096,8 +1102,8 @@ public class MavenArchiverTest
     public void testDefaultPomProperties()
         throws Exception
     {
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        Project project = getDummyProject();
         File jarFile = new File( "target/test/dummy.jar" );
         JarArchiver jarArchiver = getCleanJarArchiver( jarFile );
 
@@ -1133,8 +1139,8 @@ public class MavenArchiverTest
     public void testCustomPomProperties()
         throws Exception
     {
-        MavenSession session = getDummySession();
-        MavenProject project = getDummyProject();
+        Session session = getDummySession();
+        Project project = getDummyProject();
         File jarFile = new File( "target/test/dummy.jar" );
         JarArchiver jarArchiver = getCleanJarArchiver( jarFile );
 
@@ -1183,89 +1189,87 @@ public class MavenArchiverTest
     // common methods for testing
     // ----------------------------------------
 
-    private MavenProject getDummyProject()
+    private MockProject getDummyProject()
     {
-        MavenProject project = getMavenProject();
+        MockProject project = getMavenProject();
         File pomFile = new File( "src/test/resources/pom.xml" );
         pomFile.setLastModified( System.currentTimeMillis() - 60000L );
-        project.setFile( pomFile );
+        project.setPomPath( pomFile.toPath() );
         Build build = new Build();
         build.setDirectory( "target" );
         build.setOutputDirectory( "target" );
-        project.setBuild( build );
-        project.setName( "archiver test" );
-        project.setUrl( "https://maven.apache.org" );
+        project.getModel().setBuild( build );
+        project.getModel().setName( "archiver test" );
+        project.getModel().setUrl( "https://maven.apache.org" );
         Organization organization = new Organization();
         organization.setName( "Apache" );
-        project.setOrganization( organization );
+        project.getModel().setOrganization( organization );
         MockArtifact artifact = new MockArtifact();
         artifact.setGroupId( "org.apache.dummy" );
         artifact.setArtifactId( "dummy" );
         artifact.setVersion( "0.1.1" );
-        artifact.setBaseVersion( "0.1.2" );
-        artifact.setType( "jar" );
-        artifact.setArtifactHandler( new DefaultArtifactHandler( "jar" ) );
+//        artifact.setBaseVersion( "0.1.2" );
+        artifact.setExtension( "jar" );
+//        artifact.setArtifactHandler( new DefaultArtifactHandler( "jar" ) );
         project.setArtifact( artifact );
 
-        Set<Artifact> artifacts = getArtifacts( getMockArtifact1Release(), getMockArtifact2(), getMockArtifact3() );
-        project.setArtifacts( artifacts );
+        List<Node> artifacts = getArtifacts( getMockArtifact1Release(), getMockArtifact2(), getMockArtifact3() );
+        mockProjectManager.setResolvedDependencies( artifacts );
 
         return project;
     }
 
-    private MavenProject getMavenProject()
+    private MockProject getMavenProject()
     {
         Model model = new Model();
         model.setGroupId( "org.apache.dummy" );
         model.setArtifactId( "dummy" );
         model.setVersion( "0.1.1" );
 
-        final MavenProject project = new MavenProject( model );
-        project.setExtensionArtifacts( Collections.<Artifact>emptySet() );
-        project.setRemoteArtifactRepositories( Collections.<ArtifactRepository>emptyList() );
-        project.setPluginArtifactRepositories( Collections.<ArtifactRepository>emptyList() );
+        final MockProject project = new MockProject( model );
+//        project.setExtensionArtifacts( Collections.<Artifact>emptySet() );
+//        project.setRemoteArtifactRepositories( Collections.<ArtifactRepository>emptyList() );
+//        project.setPluginArtifactRepositories( Collections.<ArtifactRepository>emptyList() );
         return project;
     }
 
-    private MockArtifact getMockArtifact3()
+    private MockNode getMockArtifact3()
     {
         MockArtifact artifact3 = new MockArtifact();
         artifact3.setGroupId( "org.apache.dummy.bar" );
         artifact3.setArtifactId( "dummy3" );
         artifact3.setVersion( "2.0" );
-        artifact3.setScope( "runtime" );
-        artifact3.setType( "jar" );
-        artifact3.setFile( getClasspathFile( artifact3.getArtifactId() + "-" + artifact3.getVersion() + ".jar" ) );
-        return artifact3;
+        artifact3.setExtension( "jar" );
+        artifact3.setPath( getClasspathFile( artifact3.getArtifactId() + "-" + artifact3.getVersion() + ".jar" ) );
+        return new MockNode( artifact3, "runtime" );
     }
 
-    private MavenProject getDummyProjectWithSnapshot()
+    private Project getDummyProjectWithSnapshot()
     {
-        MavenProject project = getMavenProject();
+        MockProject project = getMavenProject();
         File pomFile = new File( "src/test/resources/pom.xml" );
         pomFile.setLastModified( System.currentTimeMillis() - 60000L );
-        project.setFile( pomFile );
+        project.setPomPath( pomFile.toPath() );
         Build build = new Build();
         build.setDirectory( "target" );
         build.setOutputDirectory( "target" );
-        project.setBuild( build );
-        project.setName( "archiver test" );
+        project.getModel().setBuild( build );
+        project.getModel().setName( "archiver test" );
         Organization organization = new Organization();
         organization.setName( "Apache" );
-        project.setOrganization( organization );
+        project.getModel().setOrganization( organization );
 
         MockArtifact artifact = new MockArtifact();
         artifact.setGroupId( "org.apache.dummy" );
         artifact.setArtifactId( "dummy" );
         artifact.setVersion( "0.1.1" );
-        artifact.setBaseVersion( "0.1.1" );
-        artifact.setType( "jar" );
-        artifact.setArtifactHandler( new DefaultArtifactHandler( "jar" ) );
+//        artifact.setBaseVersion( "0.1.1" );
+        artifact.setExtension( "jar" );
+//        artifact.setArtifactHandler( new DefaultArtifactHandler( "jar" ) );
         project.setArtifact( artifact );
 
-        Set<Artifact> artifacts = getArtifacts( getMockArtifact1(), getMockArtifact2(), getMockArtifact3() );
-
-        project.setArtifacts( artifacts );
+        List<Node> artifacts = getArtifacts( getMockArtifact1(), getMockArtifact2(), getMockArtifact3() );
+        mockProjectManager.setResolvedDependencies( artifacts );
 
         return project;
     }
@@ -1313,56 +1317,52 @@ public class MavenArchiverTest
         };
     }
 
-    private MockArtifact getMockArtifact2()
+    private MockNode getMockArtifact2()
     {
         MockArtifact artifact2 = new MockArtifact();
         artifact2.setGroupId( "org.apache.dummy.foo" );
         artifact2.setArtifactId( "dummy2" );
         artifact2.setVersion( "1.5" );
-        artifact2.setType( "jar" );
-        artifact2.setScope( "runtime" );
-        artifact2.setFile( getClasspathFile( artifact2.getArtifactId() + "-" + artifact2.getVersion() + ".jar" ) );
-        return artifact2;
+        artifact2.setExtension( "jar" );
+        artifact2.setPath( getClasspathFile( artifact2.getArtifactId() + "-" + artifact2.getVersion() + ".jar" ) );
+        return new MockNode( artifact2, "runtime" );
     }
 
-    private MockArtifact getArtifactWithDot()
+    private MockNode getArtifactWithDot()
     {
         MockArtifact artifact2 = new MockArtifact();
         artifact2.setGroupId( "org.apache.dummy.foo" );
         artifact2.setArtifactId( "dummy.dot" );
         artifact2.setVersion( "1.5" );
-        artifact2.setType( "jar" );
-        artifact2.setScope( "runtime" );
-        artifact2.setFile( getClasspathFile( artifact2.getArtifactId() + "-" + artifact2.getVersion() + ".jar" ) );
-        return artifact2;
+        artifact2.setExtension( "jar" );
+        artifact2.setPath( getClasspathFile( artifact2.getArtifactId() + "-" + artifact2.getVersion() + ".jar" ) );
+        return new MockNode( artifact2, "runtime" );
     }
 
-    private MockArtifact getMockArtifact1()
+    private MockNode getMockArtifact1()
     {
         MockArtifact artifact1 = new MockArtifact();
         artifact1.setGroupId( "org.apache.dummy" );
         artifact1.setArtifactId( "dummy1" );
-        artifact1.setSnapshotVersion( "1.1-20081022.112233-1", "1.1-SNAPSHOT" );
-        artifact1.setType( "jar" );
-        artifact1.setScope( "runtime" );
-        artifact1.setFile( getClasspathFile( artifact1.getArtifactId() + "-" + artifact1.getVersion() + ".jar" ) );
-        return artifact1;
+//        artifact1.setSnapshotVersion( "1.1-20081022.112233-1", "1.1-SNAPSHOT" );
+        artifact1.setExtension( "jar" );
+        artifact1.setPath( getClasspathFile( artifact1.getArtifactId() + "-" + artifact1.getVersion() + ".jar" ) );
+        return new MockNode( artifact1, "runtime" );
     }
 
-    private MockArtifact getMockArtifact1Release()
+    private MockNode getMockArtifact1Release()
     {
         MockArtifact artifact1 = new MockArtifact();
         artifact1.setGroupId( "org.apache.dummy" );
         artifact1.setArtifactId( "dummy1" );
         artifact1.setVersion( "1.0" );
-        artifact1.setBaseVersion( "1.0.1" );
-        artifact1.setType( "jar" );
-        artifact1.setScope( "runtime" );
-        artifact1.setFile( getClasspathFile( artifact1.getArtifactId() + "-" + artifact1.getVersion() + ".jar" ) );
-        return artifact1;
+//        artifact1.setBaseVersion( "1.0.1" );
+        artifact1.setExtension( "jar" );
+        artifact1.setPath( getClasspathFile( artifact1.getArtifactId() + "-" + artifact1.getVersion() + ".jar" ) );
+        return new MockNode( artifact1, "runtime" );
     }
 
-    private File getClasspathFile( String file )
+    private Path getClasspathFile( String file )
     {
         URL resource = Thread.currentThread().getContextClassLoader().getResource( file );
         if ( resource == null )
@@ -1372,10 +1372,10 @@ public class MavenArchiverTest
 
         URI uri = new File( resource.getPath() ).toURI().normalize();
 
-        return new File( uri.getPath().replaceAll( "%20", " " ) );
+        return new File( uri.getPath().replaceAll( "%20", " " ) ).toPath();
     }
 
-    private MavenSession getDummySession()
+    private Session getDummySession()
     {
         Properties systemProperties = new Properties();
         systemProperties.put( "maven.version", "3.1.1" );
@@ -1385,12 +1385,12 @@ public class MavenArchiverTest
         return getDummySession( systemProperties );
     }
 
-    private MavenSession getDummySessionWithoutMavenVersion()
+    private Session getDummySessionWithoutMavenVersion()
     {
         return getDummySession( new Properties() );
     }
 
-    private MavenSession getDummySession( Properties systemProperties )
+    private Session getDummySession( Properties systemProperties )
     {
         File settings = null;
         List<String> goals = null;
@@ -1406,20 +1406,18 @@ public class MavenArchiverTest
 
         RepositorySystemSession rss = new DefaultRepositorySystemSession();
 
-        return new MavenSession( null, rss, request, result );
-
+        MockSession session = new MockSession();
+        session.setProjectManager( mockProjectManager );
+        session.setSystemProperties( systemProperties );
+        return session;
+//        return new MavenSession( null, rss, request, result );
     }
 
-    private Set<Artifact> getArtifacts( Artifact... artifacts )
+    private List<Node> getArtifacts( Node... artifacts )
     {
-        final ArtifactHandler mockArtifactHandler = getMockArtifactHandler();
-        Set<Artifact> result = new TreeSet<>( new ArtifactComparator() );
-        for ( Artifact artifact : artifacts )
-        {
-            artifact.setArtifactHandler( mockArtifactHandler );
-            result.add( artifact );
-        }
-        return result;
+        return Stream.of( artifacts )
+                .sorted( Comparator.comparing( n -> n.getArtifact().getArtifactId() ) )
+                .collect( Collectors.toList() );
     }
 
     public Manifest getJarFileManifest( File jarFile )
@@ -1497,4 +1495,5 @@ public class MavenArchiverTest
         {
         }
     }
+
 }
diff --git a/src/test/java/org/apache/maven/archiver/MockArtifact.java b/src/test/java/org/apache/maven/archiver/MockArtifact.java
index 3bd51f9..7be48ce 100644
--- a/src/test/java/org/apache/maven/archiver/MockArtifact.java
+++ b/src/test/java/org/apache/maven/archiver/MockArtifact.java
@@ -19,267 +19,75 @@ package org.apache.maven.archiver;
  * under the License.
  */
 
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-import org.apache.maven.artifact.versioning.ArtifactVersion;
-import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
-import org.apache.maven.artifact.versioning.VersionRange;
+import javax.annotation.Nonnull;
 
-import java.io.File;
-import java.util.Collection;
-import java.util.List;
+import java.nio.file.Path;
+import java.util.Optional;
 
-/**
- * TODO move to maven-artifact-test
- */
-@SuppressWarnings( "deprecation" )
-class MockArtifact
-    implements Artifact
+import org.apache.maven.api.Artifact;
+
+public class MockArtifact implements Artifact
 {
     private String groupId;
-
     private String artifactId;
-
     private String version;
-
-    private File file;
-
-    private String scope;
-
-    private String type;
-
+    private String extension;
     private String classifier;
+    private Path path;
 
-    private String baseVersion;
-
-    private ArtifactHandler artifactHandler;
-
-    private boolean snapshot;
-
+    @Nonnull
+    @Override
     public String getGroupId()
     {
         return groupId;
     }
 
+    @Nonnull
+    @Override
     public String getArtifactId()
     {
         return artifactId;
     }
 
-    public String getVersion()
-    {
-        return version;
-    }
-
-    public void setVersion( String string )
-    {
-        this.version = string;
-    }
-
-    public void setSnapshotVersion( String snapshotVersion, String baseVersion )
-    {
-        snapshot = true;
-        version = snapshotVersion;
-        this.baseVersion = baseVersion;
-    }
-
-    public String getScope()
-    {
-        return scope;
-    }
-
-    public String getType()
-    {
-        return type;
-    }
-
+    @Nonnull
+    @Override
     public String getClassifier()
     {
         return classifier;
     }
 
-    public boolean hasClassifier()
-    {
-        return classifier != null;
-    }
-
-    public File getFile()
+    @Nonnull
+    @Override
+    public String getVersion()
     {
-        return file;
+        return version;
     }
 
-    public void setFile( File file )
+    @Nonnull
+    @Override
+    public String getExtension()
     {
-        this.file = file;
+        return extension;
     }
 
+    @Nonnull
+    @Override
     public String getBaseVersion()
     {
-        return baseVersion;
-    }
-
-    public void setBaseVersion( String string )
-    {
-        this.baseVersion = string;
-    }
-
-    public String getId()
-    {
-        return null;
-    }
-
-    public String getDependencyConflictId()
-    {
-        return null;
-    }
-
-    public void addMetadata( ArtifactMetadata artifactMetadata )
-    {
-    }
-
-    public ArtifactMetadata getMetadata( Class<?> metadataClass )
-    {
         return null;
     }
 
-    public Collection<ArtifactMetadata> getMetadataList()
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void setRepository( ArtifactRepository artifactRepository )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public ArtifactRepository getRepository()
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void updateVersion( String string, ArtifactRepository artifactRepository )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public String getDownloadUrl()
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void setDownloadUrl( String string )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public ArtifactFilter getDependencyFilter()
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void setDependencyFilter( ArtifactFilter artifactFilter )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public ArtifactHandler getArtifactHandler()
-    {
-        return artifactHandler;
-    }
-
-    public List<String> getDependencyTrail()
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void setDependencyTrail( List<String> list )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public VersionRange getVersionRange()
-    {
-        return VersionRange.createFromVersion( version );
-    }
-
-    public void setVersionRange( VersionRange versionRange )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void selectVersion( String string )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
+    @Override
     public boolean isSnapshot()
     {
-        return snapshot;
-    }
-
-    public void setResolved( boolean b )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public boolean isResolved()
-    {
-        return false;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void setResolvedVersion( String string )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void setArtifactHandler( ArtifactHandler artifactHandler )
-    {
-        this.artifactHandler = artifactHandler;
-    }
-
-    public boolean isRelease()
-    {
-        return false;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void setRelease( boolean b )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public List<ArtifactVersion> getAvailableVersions()
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return false;
     }
 
-    public void setAvailableVersions( List<ArtifactVersion> list )
+    @Nonnull
+    @Override
+    public Optional<Path> getPath()
     {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public boolean isOptional()
-    {
-        return false;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void setOptional( boolean b )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public ArtifactVersion getSelectedVersion()
-        throws OverConstrainedVersionException
-    {
-        return VersionRange.createFromVersion( version ).getSelectedVersion( this );
-    }
-
-    public boolean isSelectedVersionKnown()
-        throws OverConstrainedVersionException
-    {
-        return VersionRange.createFromVersion( version ).isSelectedVersionKnown( this );
+        return Optional.ofNullable( path );
     }
 
     public void setGroupId( String groupId )
@@ -292,23 +100,23 @@ class MockArtifact
         this.artifactId = artifactId;
     }
 
-    public void setType( String type )
+    public void setVersion( String version )
     {
-        this.type = type;
+        this.version = version;
     }
 
-    public void setClassifier( String classifier )
+    public void setExtension( String extension )
     {
-        this.classifier = classifier;
+        this.extension = extension;
     }
 
-    public void setScope( String string )
+    public void setClassifier( String classifier )
     {
-         this.scope = string;
+        this.classifier = classifier;
     }
 
-    public int compareTo( Artifact o )
+    public void setPath( Path path )
     {
-        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+        this.path = path;
     }
 }
diff --git a/src/test/java/org/apache/maven/archiver/MockNode.java b/src/test/java/org/apache/maven/archiver/MockNode.java
new file mode 100644
index 0000000..d4336ac
--- /dev/null
+++ b/src/test/java/org/apache/maven/archiver/MockNode.java
@@ -0,0 +1,113 @@
+package org.apache.maven.archiver;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Optional;
+import java.util.function.Predicate;
+
+import org.apache.maven.api.Artifact;
+import org.apache.maven.api.Dependency;
+import org.apache.maven.api.Exclusion;
+import org.apache.maven.api.Node;
+import org.apache.maven.api.NodeVisitor;
+import org.apache.maven.api.RemoteRepository;
+import org.apache.maven.api.Repository;
+
+public class MockNode implements Node, Dependency
+{
+    Artifact artifact;
+    String scope;
+    List<Node> children = new ArrayList<>();
+
+    public MockNode( Artifact artifact, String scope )
+    {
+        this.artifact = artifact;
+        this.scope = scope;
+    }
+
+    @Nonnull
+    @Override
+    public String getScope()
+    {
+        return scope;
+    }
+
+    @Nullable
+    @Override
+    public Boolean getOptional()
+    {
+        return null;
+    }
+
+    @Nonnull
+    @Override
+    public Collection<Exclusion> getExclusions()
+    {
+        return null;
+    }
+
+    @Override
+    public Artifact getArtifact()
+    {
+        return artifact;
+    }
+
+    @Override
+    public Dependency getDependency()
+    {
+        return this;
+    }
+
+    @Override
+    public List<Node> getChildren()
+    {
+        return children;
+    }
+
+    @Override
+    public List<Repository> getRemoteRepositories()
+    {
+        return null;
+    }
+
+    @Override
+    public Optional<RemoteRepository> getRepository()
+    {
+        return Optional.empty();
+    }
+
+    @Override
+    public boolean accept( NodeVisitor visitor )
+    {
+        return false;
+    }
+
+    @Override
+    public Node filter( Predicate<Node> filter )
+    {
+        return null;
+    }
+}
diff --git a/src/test/java/org/apache/maven/archiver/MockProject.java b/src/test/java/org/apache/maven/archiver/MockProject.java
new file mode 100644
index 0000000..b830a92
--- /dev/null
+++ b/src/test/java/org/apache/maven/archiver/MockProject.java
@@ -0,0 +1,121 @@
+package org.apache.maven.archiver;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.annotation.Nonnull;
+
+import java.nio.file.Path;
+import java.util.List;
+
+import org.apache.maven.api.Artifact;
+import org.apache.maven.api.Dependency;
+import org.apache.maven.api.Project;
+import org.apache.maven.model.Model;
+
+class MockProject implements Project
+{
+    private Model model;
+    private Path pomPath;
+    private Artifact artifact;
+
+    public MockProject( Model model )
+    {
+        this.model = model;
+        MockArtifact artifact = new MockArtifact();
+        artifact.setGroupId( model.getGroupId() );
+        artifact.setArtifactId( model.getArtifactId() );
+        artifact.setVersion( model.getVersion() );
+        artifact.setExtension( model.getPackaging() );
+        this.artifact = artifact;
+    }
+
+    @Nonnull
+    @Override
+    public String getGroupId()
+    {
+        return model.getGroupId();
+    }
+
+    @Nonnull
+    @Override
+    public String getArtifactId()
+    {
+        return model.getArtifactId();
+    }
+
+    @Nonnull
+    @Override
+    public String getVersion()
+    {
+        return model.getVersion();
+    }
+
+    @Nonnull
+    @Override
+    public String getPackaging()
+    {
+        return null;
+    }
+
+    @Nonnull
+    @Override
+    public Artifact getArtifact()
+    {
+        return artifact;
+    }
+
+    @Nonnull
+    @Override
+    public Model getModel()
+    {
+        return model;
+    }
+
+    @Nonnull
+    @Override
+    public Path getPomPath()
+    {
+        return pomPath;
+    }
+
+    @Nonnull
+    @Override
+    public List<Dependency> getDependencies()
+    {
+        return null;
+    }
+
+    @Nonnull
+    @Override
+    public List<Dependency> getManagedDependencies()
+    {
+        return null;
+    }
+
+    public void setPomPath( Path pomPath )
+    {
+        this.pomPath = pomPath;
+    }
+
+    public void setArtifact( Artifact artifact )
+    {
+        this.artifact = artifact;
+    }
+}
diff --git a/src/test/java/org/apache/maven/archiver/MockProjectManager.java b/src/test/java/org/apache/maven/archiver/MockProjectManager.java
new file mode 100644
index 0000000..1f73822
--- /dev/null
+++ b/src/test/java/org/apache/maven/archiver/MockProjectManager.java
@@ -0,0 +1,111 @@
+package org.apache.maven.archiver;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.annotation.Nonnull;
+
+import java.nio.file.Path;
+import java.util.Collection;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import org.apache.maven.api.Artifact;
+import org.apache.maven.api.Node;
+import org.apache.maven.api.Project;
+import org.apache.maven.api.RemoteRepository;
+import org.apache.maven.api.services.ProjectManager;
+
+public class MockProjectManager implements ProjectManager
+{
+    Collection<Node> nodes;
+
+    @Nonnull
+    @Override
+    public Optional<Path> getPath( Project project )
+    {
+        return Optional.empty();
+    }
+
+    @Nonnull
+    @Override
+    public Collection<Artifact> getAttachedArtifacts( Project project )
+    {
+        return null;
+    }
+
+    @Override
+    public void attachArtifact( Project project, String type, String classifier, Path path )
+    {
+
+    }
+
+    @Override
+    public List<String> getCompileSourceRoots( Project project )
+    {
+        return null;
+    }
+
+    @Override
+    public void addCompileSourceRoot( Project project, String sourceRoot )
+    {
+
+    }
+
+    @Override
+    public List<String> getTestCompileSourceRoots( Project project )
+    {
+        return null;
+    }
+
+    @Override
+    public void addTestCompileSourceRoot( Project project, String sourceRoot )
+    {
+
+    }
+
+    @Override
+    public List<RemoteRepository> getRepositories( Project project )
+    {
+        return null;
+    }
+
+    @Override
+    public List<Artifact> getResolvedDependencies( Project project, ResolutionScope scope )
+    {
+        return nodes.stream()
+//                .filter( n -> true )
+                .map( n-> n.getArtifact() )
+                .collect( Collectors.toList() );
+    }
+
+    @Override
+    public Node getCollectedDependencies( Project project, ResolutionScope scope )
+    {
+        MockNode node = new MockNode( project.getArtifact(), "compile" );
+        node.getChildren().addAll( nodes );
+        return node;
+    }
+
+    public void setResolvedDependencies( Collection<Node> nodes )
+    {
+        this.nodes = nodes;
+    }
+}
diff --git a/src/test/java/org/apache/maven/archiver/MockSession.java b/src/test/java/org/apache/maven/archiver/MockSession.java
new file mode 100644
index 0000000..1e8d844
--- /dev/null
+++ b/src/test/java/org/apache/maven/archiver/MockSession.java
@@ -0,0 +1,139 @@
+package org.apache.maven.archiver;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.annotation.Nonnull;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Properties;
+
+import org.apache.maven.api.Listener;
+import org.apache.maven.api.LocalRepository;
+import org.apache.maven.api.RemoteRepository;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.SessionData;
+import org.apache.maven.api.services.ProjectManager;
+import org.apache.maven.api.services.Service;
+import org.apache.maven.settings.Settings;
+
+public class MockSession implements Session
+{
+
+    private Properties systemProperties;
+    private ProjectManager projectManager;
+
+    @Nonnull
+    @Override
+    public Settings getSettings()
+    {
+        return null;
+    }
+
+    @Nonnull
+    @Override
+    public LocalRepository getLocalRepository()
+    {
+        return null;
+    }
+
+    @Nonnull
+    @Override
+    public List<RemoteRepository> getRemoteRepositories()
+    {
+        return null;
+    }
+
+    @Nonnull
+    @Override
+    public SessionData getData()
+    {
+        return null;
+    }
+
+    @Nonnull
+    @Override
+    public Properties getUserProperties()
+    {
+        return null;
+    }
+
+    @Nonnull
+    @Override
+    public Properties getSystemProperties()
+    {
+        return systemProperties;
+    }
+
+    @Nonnull
+    @Override
+    public <T extends Service> T getService( Class<T> clazz ) throws NoSuchElementException
+    {
+        if ( clazz == ProjectManager.class )
+        {
+            return (T) projectManager;
+        }
+        return null;
+    }
+
+    @Nonnull
+    @Override
+    public Session withLocalRepository( @Nonnull LocalRepository localRepository )
+    {
+        return null;
+    }
+
+    @Nonnull
+    @Override
+    public Session withRemoteRepositories( @Nonnull List<RemoteRepository> repositories )
+    {
+        return null;
+    }
+
+    @Override
+    public void registerListener( @Nonnull Listener listener )
+    {
+
+    }
+
+    @Override
+    public void unregisterListener( @Nonnull Listener listener )
+    {
+
+    }
+
+    @Nonnull
+    @Override
+    public Collection<Listener> getListeners()
+    {
+        return null;
+    }
+
+    public void setProjectManager( ProjectManager projectManager )
+    {
+        this.projectManager = projectManager;
+    }
+
+    public void setSystemProperties( Properties systemProperties )
+    {
+        this.systemProperties = systemProperties;
+    }
+}