Examples of Assembly


Examples of org.apache.maven.plugin.assembly.model.Assembly

        final MavenProject project = createMavenProject( "main-group", "main-artifact", "1", null );

        final ResolutionManagementInfo info = new ResolutionManagementInfo( project );

        new DefaultDependencyResolver( resolver, metadataSource, factory, collector, logger ).getDependencySetResolutionRequirements( new Assembly(),
                                                                                                                                      depSets,
                                                                                                                                      info,
                                                                                                                                      project );

        assertTrue( info.isResolutionRequired() );
View Full Code Here

Examples of org.apache.maven.plugin.assembly.model.Assembly

        final DefaultDependencyResolver resolver =
            new DefaultDependencyResolver( this.resolver, metadataSource, factory, collector, logger );
        resolver.enableLogging( new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );

        final Assembly assembly = new Assembly();
        assembly.setModuleSets( moduleSets );

        resolver.getModuleSetResolutionRequirements( assembly, info, cs );

        assertTrue( info.isResolutionRequired() );
View Full Code Here

Examples of org.apache.maven.plugin.assembly.model.Assembly

            r.setScope( Artifact.SCOPE_SYSTEM );
            repositories.add( r );
        }

        final MavenProject project = createMavenProject( "group", "artifact", "1.0", null );
        final Assembly assembly = new Assembly();
        assembly.setRepositories( repositories );

        final ResolutionManagementInfo info = new ResolutionManagementInfo( project );
        new DefaultDependencyResolver( resolver, metadataSource, factory, collector, logger ).getRepositoryResolutionRequirements( assembly,
                                                                                                                                   info,
                                                                                                                                   project );
View Full Code Here

Examples of org.apache.maven.plugin.assembly.model.Assembly

        // TODO: how, might we plug this into an installer, such as NSIS?

        boolean warnedAboutMainProjectArtifact = false;
        for ( final Iterator<Assembly> assemblyIterator = assemblies.iterator(); assemblyIterator.hasNext(); )
        {
            final Assembly assembly = assemblyIterator.next();
            try
            {
                final String fullName = AssemblyFormatUtils.getDistributionName( assembly, this );
               
                List<String> effectiveFormats = formats;
                if ( effectiveFormats == null || effectiveFormats.size() == 0 )
                {
                    effectiveFormats = assembly.getFormats();
                }
                if ( effectiveFormats == null || effectiveFormats.size() == 0 )
                {
                    throw new MojoFailureException( "No formats specified in the execution parameters or the assembly descriptor.");
                }

                for ( final String format : effectiveFormats )
                {
                    final File destFile = assemblyArchiver.createArchive( assembly, fullName, format, this );

                    final MavenProject project = getProject();
                    final String classifier = getClassifier();
                    final String type = project.getArtifact()
                                               .getType();

                    if ( attach && destFile.isFile() )
                    {
                        if ( isAssemblyIdAppended() )
                        {
                            projectHelper.attachArtifact( project, format, assembly.getId(), destFile );
                        }
                        else if ( classifier != null )
                        {
                            projectHelper.attachArtifact( project, format, classifier, destFile );
                        }
                        else if ( !"pom".equals( type ) && format.equals( type ) )
                        {
                            if ( !warnedAboutMainProjectArtifact )
                            {
                                final StringBuffer message = new StringBuffer();

                                message.append( "Configuration options: 'appendAssemblyId' is set to false, and 'classifier' is missing." );
                                message.append( "\nInstead of attaching the assembly file: " )
                                       .append( destFile )
                                       .append( ", it will become the file for main project artifact." );
                                message.append( "\nNOTE: If multiple descriptors or descriptor-formats are provided for this project, the value of this file will be non-deterministic!" );

                                getLog().warn( message );
                                warnedAboutMainProjectArtifact = true;
                            }

                            final File existingFile = project.getArtifact()
                                                             .getFile();
                            if ( ( existingFile != null ) && existingFile.exists() )
                            {
                                getLog().warn( "Replacing pre-existing project main-artifact file: " + existingFile
                                                               + "\nwith assembly file: " + destFile );
                            }

                            project.getArtifact()
                                   .setFile( destFile );
                        }
                        else
                        {
                            projectHelper.attachArtifact( project, format, null, destFile );
                        }
                    }
                    else if ( attach )
                    {
                        getLog().warn( "Assembly file: "
                                                       + destFile
                                                       + " is not a regular file (it may be a directory). It cannot be attached to the project build for installation or deployment." );
                    }
                }
            }
            catch ( final ArchiveCreationException e )
            {
                throw new MojoExecutionException( "Failed to create assembly: " + e.getMessage(), e );
            }
            catch ( final AssemblyFormattingException e )
            {
                throw new MojoExecutionException( "Failed to create assembly: " + e.getMessage(), e );
            }
            catch ( final InvalidAssemblerConfigurationException e )
            {
                throw new MojoFailureException( assembly, "Assembly is incorrectly configured: " + assembly.getId(),
                                                "Assembly: " + assembly.getId() + " is not configured correctly: "
                                                                + e.getMessage() );
            }
        }
    }
View Full Code Here

Examples of org.apache.maven.plugins.assembly.model.Assembly

        Model model = new Model();
        model.setArtifactId( "artifact-id" );
        model.setGroupId( "group.id" );
        model.setVersion( "1" );

        Assembly assembly = new Assembly();

        DependencySet set = new DependencySet();
        set.setOutputFileNameMapping( "${artifact.artifactId}.${artifact.extension}" );

        assembly.addDependencySet( set );

        Assembly outputAssembly = interpolator.interpolate( assembly, model, Collections.EMPTY_MAP );
       
        List outputDependencySets = outputAssembly.getDependencySets();
        assertEquals( 1, outputDependencySets.size() );
       
        DependencySet outputSet = (DependencySet) outputDependencySets.get( 0 );
       
        assertEquals( set.getOutputFileNameMapping(), outputSet.getOutputFileNameMapping() );
View Full Code Here

Examples of org.mule.registry.Assembly

      File installDir = Directories.getAssemblyInstallDir(this.container.getWorkingDir(), name);
      if (!unzip.renameTo(installDir)) {
        throw new IOException("Could not rename directory: " + unzip);
      }
      // Create assembly
      Assembly assembly = this.registry.addAssembly(name);
      assembly.setDescriptor(new JbiDescriptor(jbi));
      assembly.setInstallRoot(installDir.getAbsolutePath());
      String result = assembly.deploy();
      return result;
    } catch (Exception e) {
      LOGGER.error("Could not install shared library", e);
      throw new RuntimeException("Could not install shared library", e);
    } finally {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.