• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ArchiverException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.codehaus.plexus.archiver.ArchiverException的典型用法代码示例。如果您正苦于以下问题:Java ArchiverException类的具体用法?Java ArchiverException怎么用?Java ArchiverException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ArchiverException类属于org.codehaus.plexus.archiver包,在下文中一共展示了ArchiverException类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createArchiveFile

import org.codehaus.plexus.archiver.ArchiverException; //导入依赖的package包/类
private File createArchiveFile( File targetDirectory, String directory, String archiveExt )
    throws NoSuchArchiverException, IOException, MojoExecutionException
{
    final MavenArchiver mavenArchiver = new MavenArchiver();

    mavenArchiver.setArchiver( jarArchiver );

    jarArchiver.addFileSet( new DefaultFileSet( targetDirectory ) );
    // jarArchiver.setDuplicateBehavior( duplicate );

    File resultArchive = getArchiveFile( getOutputDirectory(), getFinalName(), directory, archiveExt );

    mavenArchiver.setOutputFile( resultArchive );
    try
    {
        mavenArchiver.createArchive( getMavenSession(), getMavenProject(), getArchive() );
    }
    catch ( ArchiverException | ManifestException | DependencyResolutionRequiredException e )
    {
        getLog().error( e.getMessage(), e );
        throw new MojoExecutionException( e.getMessage(), e );
    }

    return resultArchive;

}
 
开发者ID:khmarbaise,项目名称:multienv-maven-plugin,代码行数:27,代码来源:ConfigurationMojo.java


示例2: createIvyArchive

import org.codehaus.plexus.archiver.ArchiverException; //导入依赖的package包/类
private void createIvyArchive(File sourceDir, File targetIar) throws MojoExecutionException
{
  ZipArchiver archiver = new ZipArchiver();
  archiver.setDestFile(targetIar);
  archiver.addFileSet(getDefaultFileset(sourceDir));
  FileSetConverter fsConverter = new FileSetConverter(project.getBasedir());
  for(org.codehaus.plexus.archiver.FileSet fs : fsConverter.toPlexusFileSets(iarFileSets))
  {
    archiver.addFileSet(fs);
  }
  try
  {
    archiver.createArchive();
  }
  catch (ArchiverException | IOException ex)
  {
    throw new MojoExecutionException("Failed to create IAR: " + targetIar.getAbsolutePath(), ex);
  }
}
 
开发者ID:axonivy,项目名称:project-build-plugin,代码行数:20,代码来源:IarPackagingMojo.java


示例3: getFiles

import org.codehaus.plexus.archiver.ArchiverException; //导入依赖的package包/类
private Iterator<PlexusIoResource> getFiles(final File contentDirectory) throws IOException
{
    if (!contentDirectory.isDirectory())
    {
        throw new ArchiverException(contentDirectory.getAbsolutePath() + " is not a directory.");
    }

    final PlexusIoFileResourceCollection collection = new PlexusIoFileResourceCollection();

    collection.setIncludes(getIncludes());
    collection.setExcludes(getExcludes());
    collection.setBaseDir(contentDirectory);
    collection.setIncludingEmptyDirectories(false);
    collection.setPrefix("");
    collection.setUsingDefaultExcludes(true);

    return collection.getResources();
}
 
开发者ID:electronicarts,项目名称:ea-async,代码行数:19,代码来源:AbstractAsyncMojo.java


示例4: generateArchive

import org.codehaus.plexus.archiver.ArchiverException; //导入依赖的package包/类
private File generateArchive(File outDir, String archiveFilename) throws IOException, ArchiverException {
    File zipFile = new File(buildDir, archiveFilename);
    if (zipFile.exists()) {
        zipFile.delete();
    }

    zipArchiver.addDirectory(outDir);
    zipArchiver.setDestFile(zipFile);
    zipArchiver.createArchive();

    return zipFile;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:13,代码来源:SchemaDocMojo.java


示例5: createArchiveFile

import org.codehaus.plexus.archiver.ArchiverException; //导入依赖的package包/类
private File createArchiveFile( File unpackDirectory, File targetDirectory, String directory, String archiveExt )
    throws NoSuchArchiverException, IOException, MojoExecutionException
{
    final MavenArchiver mavenArchiver = new MavenArchiver();

    mavenArchiver.setArchiver( jarArchiver );

    jarArchiver.addFileSet( new DefaultFileSet( targetDirectory ) );
    jarArchiver.addFileSet( new DefaultFileSet( unpackDirectory ) );
    // jarArchiver.setDuplicateBehavior( duplicate );

    File resultArchive = getArchiveFile( getOutputDirectory(), getFinalName(), directory, archiveExt );

    mavenArchiver.setOutputFile( resultArchive );
    try
    {
        mavenArchiver.createArchive( getMavenSession(), getMavenProject(), getArchive() );
    }
    catch ( ArchiverException | ManifestException | DependencyResolutionRequiredException e )
    {
        getLog().error( e.getMessage(), e );
        throw new MojoExecutionException( e.getMessage(), e );
    }

    return resultArchive;

}
 
开发者ID:khmarbaise,项目名称:multienv-maven-plugin,代码行数:28,代码来源:EnvironmentMojo.java


示例6: unzip

import org.codehaus.plexus.archiver.ArchiverException; //导入依赖的package包/类
public void unzip(File output, String groupId, String artifactId, String version)
        throws MojoExecutionException {
    output.mkdirs();
    archiver.setDestDirectory(output);
    for(Artifact artifact: resolve(groupId, artifactId, version)) {
        archiver.setSourceFile(artifact.getFile());
        try {
            archiver.extract();
        } catch (ArchiverException e) {
            throw new MojoExecutionException("could not unzip: " + artifact, e);
        }
    }
}
 
开发者ID:torquebox,项目名称:jruby9-maven-plugins,代码行数:14,代码来源:ArtifactHelper.java


示例7: checkPotentialReactorProblem

import org.codehaus.plexus.archiver.ArchiverException; //导入依赖的package包/类
private void checkPotentialReactorProblem( Artifact artifact )
{
    File artifactFile = artifact.getFile();
    if ( artifactFile.isDirectory() )
    {
        throw new ArchiverException(
                                     String.format( "\"%s:%s:%s:%s\" dependent artifact's file is a directory, not a file. This is probably Maven reactor build problem.",
                                                    artifact.getGroupId(), artifact.getArtifactId(),
                                                    artifact.getType(), artifact.getBaseVersion() ) );
    }
}
 
开发者ID:play1-maven-plugin,项目名称:play1-maven-plugin,代码行数:12,代码来源:PlayDependenciesMojo.java


示例8: performPackaging

import org.codehaus.plexus.archiver.ArchiverException; //导入依赖的package包/类
/**
 * Generates the mar.
 * 
 * @param marFile
 *            the target mar file
 * @throws IOException
 * @throws ArchiverException
 * @throws ManifestException
 * @throws DependencyResolutionRequiredException
 */
private void performPackaging( File marFile )
    throws IOException, ArchiverException, ManifestException, DependencyResolutionRequiredException,
    MojoExecutionException
{

    buildExplodedMar( );

    // generate mar file
    getLog().info( "Generating mar " + marFile.getAbsolutePath() );
    MavenArchiver archiver = new MavenArchiver();
    archiver.setArchiver( jarArchiver );
    archiver.setOutputFile( marFile );
    jarArchiver.addDirectory( marDirectory );

    // create archive
    archiver.createArchive( project, archive );

    if ( classifier != null )
    {
        projectHelper.attachArtifact( project, "mar", classifier, marFile );
    }
    else
    {
        Artifact artifact = project.getArtifact();
        if ( primaryArtifact )
        {
            artifact.setFile( marFile );
        }
        else if ( artifact.getFile() == null || artifact.getFile().isDirectory() )
        {
            artifact.setFile( marFile );
        }
        else
        {
            projectHelper.attachArtifact( project, "mar", marFile );
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:49,代码来源:MarMojo.java


示例9: performPackaging

import org.codehaus.plexus.archiver.ArchiverException; //导入依赖的package包/类
/**
 * Generates the aar.
 *
 * @param aarFile the target aar file
 * @throws IOException
 * @throws ArchiverException
 * @throws ManifestException
 * @throws DependencyResolutionRequiredException
 *
 */
private void performPackaging(File aarFile)
        throws IOException, ArchiverException, ManifestException,
        DependencyResolutionRequiredException,
        MojoExecutionException {

    buildExplodedAar();

    // generate aar file
    getLog().info("Generating aar " + aarFile.getAbsolutePath());
    MavenArchiver archiver = new MavenArchiver();
    archiver.setArchiver(jarArchiver);
    archiver.setOutputFile(aarFile);
    jarArchiver.addDirectory(aarDirectory);

    // create archive
    archiver.createArchive(project, archive);

    if (classifier != null) {
        projectHelper.attachArtifact(project, "aar", classifier, aarFile);
    } else {
        Artifact artifact = project.getArtifact();
        if (primaryArtifact) {
            artifact.setFile(aarFile);
        } else if (artifact.getFile() == null || artifact.getFile().isDirectory()) {
            artifact.setFile(aarFile);
        } else {
            projectHelper.attachArtifact(project, "aar", aarFile);
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:41,代码来源:AarMojo.java


示例10: extractApklib

import org.codehaus.plexus.archiver.ArchiverException; //导入依赖的package包/类
public void extractApklib( Artifact apklibArtifact ) throws MojoExecutionException
{
    final File apkLibFile = artifactResolverHelper.resolveArtifactToFile( apklibArtifact );
    if ( apkLibFile.isDirectory() )
    {
        log.warn(
                "The apklib artifact points to '" + apkLibFile + "' which is a directory; skipping unpacking it." );
        return;
    }

    final UnArchiver unArchiver = new ZipUnArchiver ( apkLibFile )
    {
        @Override
        protected Logger getLogger()
        {
            return new ConsoleLogger( log.getThreshold(), "dependencies-unarchiver" );
        }
    };

    final File apklibDirectory = getUnpackedLibFolder( apklibArtifact );
    apklibDirectory.mkdirs();
    unArchiver.setDestDirectory( apklibDirectory );
    log.debug( "Extracting APKLIB to " + apklibDirectory );
    try
    {
        unArchiver.extract();
    }
    catch ( ArchiverException e )
    {
        throw new MojoExecutionException ( "ArchiverException while extracting " + apklibDirectory
                + ". Message: " + e.getLocalizedMessage(), e );
    }
}
 
开发者ID:simpligility,项目名称:android-ndk-maven-plugin,代码行数:34,代码来源:UnpackedLibHelper.java


示例11: shouldNotUnpackViewResourcesThatDoNotMatchTheFilters

import org.codehaus.plexus.archiver.ArchiverException; //导入依赖的package包/类
@Test
public void shouldNotUnpackViewResourcesThatDoNotMatchTheFilters() throws MojoExecutionException,
        MojoFailureException, NoSuchArchiverException, ArchiverException {
    // Given
    UnpackViewResources mojo = new UnpackViewResources() {
        @Override
        protected Embedder newEmbedder() {
            return new Embedder();
        }

    };
    ArchiverManager archiveManager = mock(ArchiverManager.class);
    MavenProject project = mock(MavenProject.class);

    File resourcesFile = new File("some");
    Artifact someResources = mock(Artifact.class);
    when(someResources.getArtifactId()).thenReturn("some-resources");
    when(someResources.getType()).thenReturn("jar");
    when(someResources.getFile()).thenReturn(resourcesFile);

    Set<Artifact> allArtifacts = new HashSet<Artifact>();
    allArtifacts.add(someResources);

    String buildDirectory = "target";
    Build build = new Build();
    build.setDirectory(buildDirectory);

    // When
    mojo.project = project;
    mojo.archiverManager = archiveManager;
    mojo.resourceIncludes = "ftl/*";
    mojo.resourcesExcludes = "com/*";
    when(project.getArtifacts()).thenReturn(allArtifacts);
    when(project.getBuild()).thenReturn(build);

    mojo.execute();

    // Then
    verify(archiveManager, Mockito.never()).getUnArchiver(resourcesFile);
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:41,代码来源:EmbedderMojoBehaviour.java


示例12: shouldNotIgnoreFailureInUnpackingViewResources

import org.codehaus.plexus.archiver.ArchiverException; //导入依赖的package包/类
@Test(expected = MojoExecutionException.class)
public void shouldNotIgnoreFailureInUnpackingViewResources() throws MojoExecutionException, MojoFailureException,
        NoSuchArchiverException, ArchiverException {
    // Given
    UnpackViewResources mojo = new UnpackViewResources() {
        @Override
        protected Embedder newEmbedder() {
            return new Embedder();
        }

    };
    ArchiverManager archiveManager = mock(ArchiverManager.class);
    MavenProject project = mock(MavenProject.class);

    File coreFile = new File("core");
    Artifact coreResources = mock(Artifact.class);
    when(coreResources.getArtifactId()).thenReturn("jbehave-core");
    when(coreResources.getType()).thenReturn("zip");
    when(coreResources.getFile()).thenReturn(coreFile);
    File siteFile = new File("site");
    Artifact siteResources = mock(Artifact.class);
    when(siteResources.getArtifactId()).thenReturn("jbehave-site-resources");
    when(siteResources.getType()).thenReturn("zip");
    when(siteResources.getFile()).thenReturn(siteFile);

    Set<Artifact> allArtifacts = new HashSet<Artifact>();
    allArtifacts.add(coreResources);
    allArtifacts.add(siteResources);

    String buildDirectory = "target";
    Build build = new Build();
    build.setDirectory(buildDirectory);

    UnArchiver coreArchiver = mock(UnArchiver.class);
    UnArchiver siteArchiver = mock(UnArchiver.class);

    // When
    mojo.project = project;
    mojo.archiverManager = archiveManager;
    when(project.getArtifacts()).thenReturn(allArtifacts);
    when(project.getBuild()).thenReturn(build);
    when(archiveManager.getUnArchiver(coreFile)).thenReturn(coreArchiver);
    when(archiveManager.getUnArchiver(siteFile)).thenReturn(siteArchiver);
    Mockito.doThrow(new ArchiverException("bum")).when(siteArchiver).extract();

    mojo.execute();

    // Then
    verify(coreArchiver).extract();
    // and fail as expected ...
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:52,代码来源:EmbedderMojoBehaviour.java


示例13: copyFile

import org.codehaus.plexus.archiver.ArchiverException; //导入依赖的package包/类
/**
 * Copy file from source to destination. The directories up to <code>destination</code> will be created if they
 * don't already exist. if the <code>onlyIfModified</code> flag is <tt>false</tt>, <code>destination</code> will be
 * overwritten if it already exists. If the flag is <tt>true</tt> destination will be overwritten if it's not up to
 * date.
 * <p/>
 *
 * @param context the packaging context
 * @param source an existing non-directory <code>File</code> to copy bytes from
 * @param destination a non-directory <code>File</code> to write bytes to (possibly overwriting).
 * @param targetFilename the relative path of the file from the webapp root directory
 * @param onlyIfModified if true, copy the file only if the source has changed, always copy otherwise
 * @return true if the file has been copied/updated, false otherwise
 * @throws IOException if <code>source</code> does not exist, <code>destination</code> cannot be written to, or an
 *             IO error occurs during copying
 */
protected boolean copyFile( WarPackagingContext context, File source, File destination, String targetFilename,
                            boolean onlyIfModified )
    throws IOException
{
    if ( onlyIfModified && destination.lastModified() >= source.lastModified() )
    {
        context.getLog().debug( " * " + targetFilename + " is up to date." );
        return false;
    }
    else
    {
        if ( source.isDirectory() )
        {
            context.getLog().warn( " + " + targetFilename + " is packaged from the source folder" );

            try
            {
                JarArchiver archiver = context.getJarArchiver();
                archiver.addDirectory( source );
                archiver.setDestFile( destination );
                archiver.createArchive();
            }
            catch ( ArchiverException e )
            {
                String msg = "Failed to create " + targetFilename;
                context.getLog().error( msg, e );
                IOException ioe = new IOException( msg );
                ioe.initCause( e );
                throw ioe;
            }
        }
        else
        {
            FileUtils.copyFile( source.getCanonicalFile(), destination );
            // preserve timestamp
            destination.setLastModified( source.lastModified() );
            context.getLog().debug( " + " + targetFilename + " has been copied." );
        }
        return true;
    }
}
 
开发者ID:zhegexiaohuozi,项目名称:maven-seimicrawler-plugin,代码行数:58,代码来源:AbstractWarPackagingTask.java


示例14: execute

import org.codehaus.plexus.archiver.ArchiverException; //导入依赖的package包/类
/**
    * 
    */    
public void execute() throws MojoExecutionException, MojoFailureException 
{
    if ( puXMLFile == null || !FileUtils.fileExists( puXMLFile ) )
    {
        throw new MojoExecutionException( "missing pu.xml file" );
    }
        
    if ( warFile == null || !FileUtils.fileExists( warFile ) )
    {
        throw new MojoExecutionException( "missing war file" );
    }
    
    try
       {
        String puTargetDir = serverDirectory + File.separator + "META-INF" + File.separator + "spring";
        String libTargetDir = serverDirectory + File.separator + "lib";
        
        FileUtils.mkdir( serverDirectory );	        
        FileUtils.mkdir( puTargetDir );
        FileUtils.mkdir( libTargetDir );
        
           FileUtils.copyFileToDirectory( new File( puXMLFile ), new File( puTargetDir ) );
           FileUtils.copyFileToDirectory( new File( warFile ), new File( serverDirectory ) );
           
           
            for (Iterator artifactIterator = pluginArtifacts.iterator(); artifactIterator.hasNext();) 
            {
               Artifact artifact = (Artifact) artifactIterator.next();
               if (artifact.getGroupId().equals("org.mortbay.jetty") ) 
               {
                   FileUtils.copyFileToDirectory( artifact.getFile().getPath(), libTargetDir );
               }
            }
            
            jarArchiver.addDirectory( new File(serverDirectory) );
            jarArchiver.setDestFile( new File(artifactName) );
            jarArchiver.createArchive();
       }
       catch ( IOException ioe )
       {
           throw new MojoExecutionException( "unable to assemble",ioe );
       }
       catch ( ArchiverException ae )
       {
           throw new MojoExecutionException( "unable to assembly jar", ae );
       }
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:51,代码来源:JOSGeneratePUMojo.java


示例15: expandArchive

import org.codehaus.plexus.archiver.ArchiverException; //导入依赖的package包/类
protected void expandArchive( Archiver archiver, File destDirectory )
    throws IOException
{
    for ( ResourceIterator iter = archiver.getResources(); iter.hasNext(); )
    {
        ArchiveEntry entry = iter.next();
        String name = entry.getName();
        name = name.replace( File.separatorChar, '/' );
        File destFile = new File( destDirectory, name );

        switch ( entry.getType() )
        {
            case ArchiveEntry.DIRECTORY:
                if ( !destFile.exists() )
                {
                    getLog().debug( "adding directory " + name + '/' );
                    if ( !destFile.mkdirs() )
                    {
                        throw new IOException( "Unable to create directory: " + destFile );
                    }
                }
                break;
            case ArchiveEntry.FILE:
                PlexusIoResource resource = entry.getResource();
                boolean skip = false;
                if ( !destFile.exists() )
                {
                    getLog().debug( "adding file " + name );
                }
                else
                {
                    long resLastModified = resource.getLastModified();
                    if ( resLastModified != PlexusIoResource.UNKNOWN_MODIFICATION_DATE )
                    {
                        long destFileLastModified = destFile.lastModified();
                        if ( resLastModified <= destFileLastModified )
                        {
                            skip = true;
                        }
                        else
                        {
                            getLog().debug( "updating file " + name );
                        }
                    }
                }
                if ( !skip )
                {
                    InputStream contents = resource.getContents();
                    RawInputStreamFacade facade = new RawInputStreamFacade( contents );
                    FileUtils.copyStreamToFile( facade, destFile );
                }
                break;
            default:
                throw new ArchiverException( "Unknown archive entry type: " + entry.getType() );
        }
    }
}
 
开发者ID:play1-maven-plugin,项目名称:play1-maven-plugin,代码行数:58,代码来源:AbstractArchivingMojo.java


示例16: createArchive

import org.codehaus.plexus.archiver.ArchiverException; //导入依赖的package包/类
public File createArchive() throws MojoExecutionException {
    final File outputDirectory = projectBuildDirectory;
    File narFile = getNarFile(outputDirectory, finalName, classifier);
    MavenArchiver archiver = new MavenArchiver();
    archiver.setArchiver(jarArchiver);
    archiver.setOutputFile(narFile);
    archive.setForced(forceCreation);

    try {
        File contentDirectory = getClassesDirectory();
        if (!contentDirectory.exists()) {
            getLog().warn("NAR will be empty - no content was marked for inclusion!");
        } else {
            archiver.getArchiver().addDirectory(contentDirectory, getIncludes(), getExcludes());
        }

        File existingManifest = defaultManifestFile;
        if (useDefaultManifestFile && existingManifest.exists() && archive.getManifestFile() == null) {
            getLog().info("Adding existing MANIFEST to archive. Found under: " + existingManifest.getPath());
            archive.setManifestFile(existingManifest);
        }

        // automatically add the artifact id, group id, and version to the manifest
        archive.addManifestEntry("Nar-Id", narId);
        archive.addManifestEntry("Nar-Group", narGroup);
        archive.addManifestEntry("Nar-Version", narVersion);

        // look for a nar dependency
        NarDependency narDependency = getNarDependency();
        if (narDependency != null) {
            final String narDependencyGroup = notEmpty(this.narDependencyGroup) ? this.narDependencyGroup : narDependency.getGroupId();
            final String narDependencyId = notEmpty(this.narDependencyId) ? this.narDependencyId : narDependency.getArtifactId();
            final String narDependencyVersion = notEmpty(this.narDependencyVersion) ? this.narDependencyVersion : narDependency.getVersion();

            archive.addManifestEntry("Nar-Dependency-Group", narDependencyGroup);
            archive.addManifestEntry("Nar-Dependency-Id", narDependencyId);
            archive.addManifestEntry("Nar-Dependency-Version", narDependencyVersion);
        }

        // add build information when available

        if (notEmpty(buildTag)) {
            archive.addManifestEntry("Build-Tag", buildTag);
        }
        if (notEmpty(buildBranch)) {
            archive.addManifestEntry("Build-Branch", buildBranch);
        }
        if (notEmpty(buildRevision)) {
            archive.addManifestEntry("Build-Revision", buildRevision);
        }

        SimpleDateFormat dateFormat = new SimpleDateFormat(BUILD_TIMESTAMP_FORMAT);
        archive.addManifestEntry("Build-Timestamp", dateFormat.format(new Date()));

        archive.addManifestEntry("Clone-During-Instance-Class-Loading", String.valueOf(cloneDuringInstanceClassLoading));

        archiver.createArchive(session, project, archive);
        return narFile;
    } catch (ArchiverException | MojoExecutionException | ManifestException | IOException | DependencyResolutionRequiredException e) {
        throw new MojoExecutionException("Error assembling NAR", e);
    }
}
 
开发者ID:apache,项目名称:nifi-maven,代码行数:63,代码来源:NarMojo.java


示例17: shouldUnpackViewResources

import org.codehaus.plexus.archiver.ArchiverException; //导入依赖的package包/类
@Test
public void shouldUnpackViewResources() throws MojoExecutionException, MojoFailureException,
        NoSuchArchiverException, ArchiverException {
    // Given
    UnpackViewResources mojo = new UnpackViewResources() {
        @Override
        protected Embedder newEmbedder() {
            return new Embedder();
        }

    };
    ArchiverManager archiveManager = mock(ArchiverManager.class);
    MavenProject project = mock(MavenProject.class);

    File coreFile = new File("core");
    Artifact coreResources = mock(Artifact.class);
    when(coreResources.getArtifactId()).thenReturn("jbehave-core");
    when(coreResources.getType()).thenReturn("zip");
    when(coreResources.getFile()).thenReturn(coreFile);
    File siteFile = new File("site");
    Artifact siteResources = mock(Artifact.class);
    when(siteResources.getArtifactId()).thenReturn("jbehave-site-resources");
    when(siteResources.getType()).thenReturn("zip");
    when(siteResources.getFile()).thenReturn(siteFile);

    Set<Artifact> allArtifacts = new HashSet<Artifact>();
    allArtifacts.add(coreResources);
    allArtifacts.add(siteResources);

    String buildDirectory = "target";
    Build build = new Build();
    build.setDirectory(buildDirectory);

    UnArchiver coreArchiver = mock(UnArchiver.class);
    UnArchiver siteArchiver = mock(UnArchiver.class);

    // When
    mojo.project = project;
    mojo.archiverManager = archiveManager;
    mojo.resourceIncludes = "ftl/*";
    mojo.resourcesExcludes = "com/*";
    when(project.getArtifacts()).thenReturn(allArtifacts);
    when(project.getBuild()).thenReturn(build);
    when(archiveManager.getUnArchiver(coreFile)).thenReturn(coreArchiver);
    when(archiveManager.getUnArchiver(siteFile)).thenReturn(siteArchiver);

    unpackTo(mojo, null); // default view directory
    unpackTo(mojo, new File(System.getProperty("java.io.tmpdir")+"/jbehave/view"));

    // Then
    verify(coreArchiver, times(2)).extract();
    verify(siteArchiver, times(2)).extract();
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:54,代码来源:EmbedderMojoBehaviour.java



注:本文中的org.codehaus.plexus.archiver.ArchiverException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NodeFilter类代码示例发布时间:2022-05-21
下一篇:
Java TableHeaderUI类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap