Package org.apache.maven.artifact.repository.layout

Examples of org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout


            if (bundle.startsWith(MVN_URI_PREFIX)) {
                bundle = bundle.substring(MVN_URI_PREFIX.length());
            }
            String repo = bundle.substring(0, bundle.indexOf(MVN_REPO_SEPARATOR));
            ArtifactRepository repository = new DefaultArtifactRepository(artifact.getArtifactId() + "-repo", repo,
                    new DefaultRepositoryLayout());
            List<ArtifactRepository> repos = new LinkedList<ArtifactRepository>();
            repos.add(repository);
            resolver.resolve(artifact, repos, localRepo);
        } else {
            resolver.resolve(artifact, remoteRepos, localRepo);
View Full Code Here


    {
        super.setUp();

        localRepository = new DefaultArtifactRepository( "local",
           new File( getBasedir(), "target/test-classes/repositories/local" ).toURI().toString(),
           new DefaultRepositoryLayout() );
    }
View Full Code Here

        super.setUp();

        String repositories = new File( getBasedir(), "target/test-classes/repositories" ).toURI().toString();

        localRepository =
            new DefaultArtifactRepository( "local", repositories + "/local", new DefaultRepositoryLayout() );

        remoteRepository = repositories + "/central";

        generator = (ArchetypeGenerator) lookup( ArchetypeGenerator.ROLE );
        assertNotNull( generator );
View Full Code Here

            throw new MojoExecutionException("Could not interpret features XML file", e);
        }
    }

    private File createArchive(List<Artifact> bundles) throws MojoExecutionException {
        ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
        File archiveFile = getArchiveFile(outputDirectory, finalName, null);

        MavenArchiver archiver = new MavenArchiver();
        archiver.setArchiver(jarArchiver);
        archiver.setOutputFile(archiveFile);

        try {
            // include the features XML file
            Artifact featureArtifact = factory.createArtifactWithClassifier(project.getGroupId(), project.getArtifactId(), project.getVersion(), "xml", KarArtifactInstaller.FEATURES_CLASSIFIER);
            jarArchiver.addFile(featuresFile, repositoryPath + layout.pathOf(featureArtifact));

            for (Artifact artifact : bundles) {
                resolver.resolve(artifact, remoteRepos, localRepo);
                File localFile = artifact.getFile();
                // TODO this may not be reasonable, but... resolved snapshot artifacts have timestamped versions
                // which do not work in startup.properties
                artifact.setVersion(artifact.getBaseVersion());
                String targetFileName = repositoryPath + layout.pathOf(artifact);
                jarArchiver.addFile(localFile, targetFileName);
            }

            if (resourcesDir.isDirectory()) {
                archiver.getArchiver().addDirectory(resourcesDir);
View Full Code Here

    /** {@inheritDoc} */
    @Override
    public List<ArtifactRepository> getRemoteArtifactRepositories()
    {
        ArtifactRepository repository = new DefaultArtifactRepository( "central", "http://repo1.maven.org/maven2",
                                                                       new DefaultRepositoryLayout() );

        return Collections.singletonList( repository );
    }
View Full Code Here

        {
            localRepository = getSettings().getLocalRepository();
        }

        return new DefaultArtifactRepository( "local-repository", "file://" + localRepository,
                                              new DefaultRepositoryLayout() );
    }
View Full Code Here

    private ArtifactRepository getLocalRepository()
    {
        if ( repository == null )
        {
            return new DefaultArtifactRepository( "local-repository", "file://" + settings.getLocalRepository(),
                                                  new DefaultRepositoryLayout() );
        }
        else
        {
            return new DefaultArtifactRepository( repository.getName(), "file://" + repository.getLocation(),
                                                  new DefaultRepositoryLayout() );
        }
    }
View Full Code Here

            throw new MojoExecutionException("Could not interpret features XML file", e);
        }
    }

    private File createArchive(List<Artifact> bundles) throws MojoExecutionException {
        ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
        File archiveFile = getArchiveFile(outputDirectory, finalName, null);

        MavenArchiver archiver = new MavenArchiver();
        MavenArchiveConfiguration configuration = new MavenArchiveConfiguration();
        archiver.setArchiver(jarArchiver);
        archiver.setOutputFile(archiveFile);

        try {
            // include the features XML file
            Artifact featureArtifact = factory.createArtifactWithClassifier(project.getGroupId(), project.getArtifactId(), project.getVersion(), "xml", KarArtifactInstaller.FEATURES_CLASSIFIER);
            jarArchiver.addFile(featuresFile, repositoryPath + layout.pathOf(featureArtifact));

            for (Artifact artifact : bundles) {
                resolver.resolve(artifact, remoteRepos, localRepo);
                File localFile = artifact.getFile();
                // TODO this may not be reasonable, but... resolved snapshot artifacts have timestamped versions
                // which do not work in startup.properties
                artifact.setVersion(artifact.getBaseVersion());
                String targetFileName = repositoryPath + layout.pathOf(artifact);
                jarArchiver.addFile(localFile, targetFileName);
            }

            if (resourcesDir.isDirectory()) {
                archiver.getArchiver().addDirectory(resourcesDir);
View Full Code Here

            if (bundle.startsWith(MVN_URI_PREFIX)) {
                bundle = bundle.substring(MVN_URI_PREFIX.length());
            }
            String repo = bundle.substring(0, bundle.indexOf(MVN_REPO_SEPARATOR));
            ArtifactRepository repository = new DefaultArtifactRepository(artifact.getArtifactId() + "-repo", repo,
                                                                          new DefaultRepositoryLayout());
            List<ArtifactRepository> repos = new LinkedList<ArtifactRepository>();
            repos.add(repository);
            resolver.resolve(artifact, repos, localRepo);
        } else {
            resolver.resolve(artifact, remoteRepos, localRepo);
View Full Code Here

    {
        // HACK: START
        // TODO: Work out how to use Plexus to obtain these values
        String url = "file://" + localRepositoryDirectory;
        ArtifactRepository localRepository =
            new DefaultArtifactRepository( "local", url, new DefaultRepositoryLayout() );

        ArtifactFactory artifactFactory = new DefaultArtifactFactory();

        DefaultArtifactHandler javaSourceArtifactHandler = new DefaultArtifactHandler( "java-source" );
        setVariableValueToObject( javaSourceArtifactHandler, "extension", "jar" );
View Full Code Here

TOP

Related Classes of org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout

Copyright © 2018 www.massapicom. 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.