当前位置: 首页>>代码示例>>Java>>正文


Java DefaultArtifactRepository类代码示例

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


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

示例1: createLocalRepository

import org.apache.maven.artifact.repository.DefaultArtifactRepository; //导入依赖的package包/类
private ArtifactRepository createLocalRepository(MavenEmbedderSettings generalSettings) {
  ArtifactRepositoryLayout layout = getComponent(ArtifactRepositoryLayout.class, "default");
  ArtifactRepositoryFactory factory = getComponent(ArtifactRepositoryFactory.class);

  String url = mySettings.getLocalRepository();
  if (!url.startsWith("file:")) url = "file://" + url;

  ArtifactRepository localRepository = new DefaultArtifactRepository("local", url, layout);

  boolean snapshotPolicySet = mySettings.isOffline();
  if (!snapshotPolicySet && generalSettings.getSnapshotUpdatePolicy() == MavenEmbedderSettings.UpdatePolicy.ALWAYS_UPDATE) {
    factory.setGlobalUpdatePolicy(ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS);
  }
  factory.setGlobalChecksumPolicy(ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN);

  return localRepository;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:MavenEmbedder.java

示例2: setUpProject

import org.apache.maven.artifact.repository.DefaultArtifactRepository; //导入依赖的package包/类
private void setUpProject( File pomFile, AbstractMojo mojo )
    throws Exception
{
    MavenProjectBuilder builder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );

    ArtifactRepositoryLayout localRepositoryLayout =
        (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" );

    String path = "src/test/repository";

    ArtifactRepository localRepository =
        new DefaultArtifactRepository( "local", "file://" + new File( path ).getAbsolutePath(),
                                       localRepositoryLayout );

    MavenProject project = builder.buildWithDependencies( pomFile, localRepository, null );
    // this gets the classes for these tests of this mojo (exec plugin) onto the project classpath for the test
    project.getBuild().setOutputDirectory( new File( "target/test-classes" ).getAbsolutePath() );
    setVariableValueToObject( mojo, "project", project );
}
 
开发者ID:mojohaus,项目名称:exec-maven-plugin,代码行数:20,代码来源:ExecJavaMojoTest.java

示例3: createHelper

import org.apache.maven.artifact.repository.DefaultArtifactRepository; //导入依赖的package包/类
private DefaultVersionsHelper createHelper( String rulesUri, ArtifactMetadataSource metadataSource )
    throws MojoExecutionException
{
    final DefaultWagonManager wagonManager = new DefaultWagonManager()
    {
        public Wagon getWagon( Repository repository )
            throws UnsupportedProtocolException, WagonConfigurationException
        {
            return new FileWagon();
        }
    };

    DefaultVersionsHelper helper =
        new DefaultVersionsHelper( new DefaultArtifactFactory(), new DefaultArtifactResolver(), metadataSource, new ArrayList(),
                                   new ArrayList(),
                                   new DefaultArtifactRepository( "", "", new DefaultRepositoryLayout() ),
                                   wagonManager, new Settings(), "", rulesUri, mock( Log.class ), mock( MavenSession.class ),
                                   new DefaultPathTranslator());
    return helper;
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:21,代码来源:DefaultVersionsHelperTest.java

示例4: createHelper

import org.apache.maven.artifact.repository.DefaultArtifactRepository; //导入依赖的package包/类
private VersionsHelper createHelper( String rulesUri, ArtifactMetadataSource metadataSource )
    throws MojoExecutionException
{
    final DefaultWagonManager wagonManager = new DefaultWagonManager()
    {
        public Wagon getWagon( Repository repository )
            throws UnsupportedProtocolException, WagonConfigurationException
        {
            return new FileWagon();
        }
    };

    VersionsHelper helper =
        new DefaultVersionsHelper( new DefaultArtifactFactory(), new DefaultArtifactResolver(), metadataSource, new ArrayList(),
                                   new ArrayList(),
                                   new DefaultArtifactRepository( "", "", new DefaultRepositoryLayout() ),
                                   wagonManager, new Settings(), "", rulesUri, mock( Log.class ), mock( MavenSession.class ),
                                   new DefaultPathTranslator());
    return helper;
}
 
开发者ID:petr-ujezdsky,项目名称:versions-maven-plugin-svn-clone,代码行数:21,代码来源:DefaultVersionsHelperTest.java

示例5: resolve

import org.apache.maven.artifact.repository.DefaultArtifactRepository; //导入依赖的package包/类
private Object resolve(String bundle) throws Exception, ArtifactNotFoundException {
    if (!isMavenProtocol(bundle)) {
        return bundle;
    }
    Artifact artifact = getArtifact(bundle);
    if (bundle.indexOf(MVN_REPO_SEPARATOR) >= 0) {
        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);
    }
    if (artifact == null) {
        throw new Exception("Unable to resolve artifact for uri " + bundle);
    } else {
        return artifact;
    }
}
 
开发者ID:retog,项目名称:karaf-maven-plugin,代码行数:25,代码来源:ValidateDescriptorMojo.java

示例6: initialize

import org.apache.maven.artifact.repository.DefaultArtifactRepository; //导入依赖的package包/类
protected void initialize() throws Exception {
    basedir = getBasedir();

    File settingsFile = new File(System.getProperty("user.home"), ".m2/settings.xml");
    String localRepo = null;
    if (settingsFile.exists()) {
        Settings settings = new SettingsXpp3Reader().read(new FileReader(settingsFile));
        localRepo = settings.getLocalRepository();
    } else {
        localRepo = System.getProperty("user.home") + "/.m2/repository";
    }
    if (localRepo == null) {
        localRepo = System.getProperty("user.home") + "/.m2/repository";
    }

    localRepository = new DefaultArtifactRepository("local", "file://" + localRepo, new DefaultRepositoryLayout());

}
 
开发者ID:mulesoft,项目名称:mule-tooling-incubator,代码行数:19,代码来源:MavenArtifactResolver.java

示例7: retrieveAvailableVersions

import org.apache.maven.artifact.repository.DefaultArtifactRepository; //导入依赖的package包/类
@NotNull
@Override
public List<String> retrieveAvailableVersions(@NotNull String groupId,
                                              @NotNull String artifactId,
                                              @NotNull List<MavenRemoteRepository> remoteRepositories)
  throws RemoteException {
  try {
    Artifact artifact =
      new DefaultArtifact(groupId, artifactId, VersionRange.createFromVersion(""), Artifact.SCOPE_COMPILE, "pom", null,
                          new DefaultArtifactHandler("pom"));
    ArtifactRepositoryLayout repositoryLayout = getComponent(ArtifactRepositoryLayout.class);
    List versions = getComponent(ArtifactMetadataSource.class).retrieveAvailableVersions(
      artifact,
      new DefaultArtifactRepository(
        "local",
        getLocalRepositoryFile().getPath(),
        repositoryLayout),
      convertRepositories(remoteRepositories));

    List<String> result = new ArrayList<String>();
    for (Object version : versions) {
      result.add(version.toString());
    }
    return result;
  }
  catch (Exception e) {
    Maven2ServerGlobals.getLogger().info(e);
  }
  return Collections.emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:Maven2ServerEmbedderImpl.java

示例8: setUpProject

import org.apache.maven.artifact.repository.DefaultArtifactRepository; //导入依赖的package包/类
private void setUpProject( File pomFile, ExecMojo mojo )
    throws Exception
{
    MavenProjectBuilder builder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );

    ArtifactRepositoryLayout localRepositoryLayout =
        (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" );

    String path = "src/test/repository";

    ArtifactRepository localRepository =
        new DefaultArtifactRepository( "local", "file://" + new File( path ).getAbsolutePath(),
                                       localRepositoryLayout );

    mojo.setBasedir( File.createTempFile( "mvn-temp", "txt" ).getParentFile() );

    MavenProject project = builder.buildWithDependencies( pomFile, localRepository, null );

    // this gets the classes for these tests of this mojo (exec plugin) onto the project classpath for the test
    project.getBuild().setOutputDirectory( new File( "target/test-classes" ).getAbsolutePath() );

    mojo.setProject( project );

    mojo.setLog( new SystemStreamLog()
    {
        public boolean isDebugEnabled()
        {
            return true;
        }
    } );
}
 
开发者ID:mojohaus,项目名称:exec-maven-plugin,代码行数:32,代码来源:ExecMojoTest.java

示例9: testExecute

import org.apache.maven.artifact.repository.DefaultArtifactRepository; //导入依赖的package包/类
/**
 * Validate the generation of a java files from purchaseorder.xsd.
 * 
 * @throws MojoExecutionException
 */
public void testExecute() throws Exception {

	final File pom = new File(getBaseDir(),
			"pom.xml");

	final ArtifactRepository localRepository = new DefaultArtifactRepository(
			"local",

			new File(getBaseDir(), "target/test-repository").toURI()
					.toURL().toString(), new DefaultRepositoryLayout());

	final MavenProject mavenProject = mavenProjectBuilder.build(pom,
			localRepository, null);

	final Hyperjaxb3Mojo generator = (Hyperjaxb3Mojo) lookupMojo(
			"org.jvnet.hyperjaxb3",
			"hyperjaxb3-maven-plugin",
			"0.5.4-SNAPSHOT",
			"generate", null);
	generator.setProject(mavenProject);
	generator.setLocalRepository(localRepository);
	generator.setSchemaDirectory(new File(getBaseDir(),
			"src/main/resources"));
	generator.setSchemaIncludes(new String[] { "*.xsd" });
	generator.setBindingIncludes(new String[] { "*.xjb" });
	generator.setGenerateDirectory(new File(getBaseDir(),
			"target/test/generated-sources"));
	generator.setVerbose(true);
	generator.setRemoveOldOutput(true);
	generator.execute();
}
 
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:37,代码来源:RunPoPlugin.java

示例10: setUp

import org.apache.maven.artifact.repository.DefaultArtifactRepository; //导入依赖的package包/类
protected void setUp() throws Exception {
	super.setUp();

	mavenProjectBuilder = (MavenProjectBuilder) getContainer().lookup(
			MavenProjectBuilder.ROLE);
	ArtifactFactory artifactFactory = (ArtifactFactory) getContainer()
			.lookup(ArtifactFactory.ROLE);

	final Map<String, Mojo> mojos = (Map<String, Mojo>) getContainer()
			.lookupMap(Mojo.ROLE);

	for (Mojo mojo : mojos.values()) {
		if (mojo instanceof Hyperjaxb3Mojo) {
			this.mojo = (Hyperjaxb3Mojo) mojo;
		}
	}

	MavenSettingsBuilder settingsBuilder = (MavenSettingsBuilder) getContainer()
			.lookup(MavenSettingsBuilder.ROLE);
	ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) getContainer()
			.lookup(ArtifactRepositoryLayout.ROLE, "default");

	Settings settings = settingsBuilder.buildSettings();

	String url = settings.getLocalRepository();

	if (!url.startsWith("file:")) {
		url = "file://" + url;
	}

	localRepository = new DefaultArtifactRepository("local", url,
			new DefaultRepositoryLayout());
}
 
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:34,代码来源:RunEpisodesBPlugin.java

示例11: testExecute

import org.apache.maven.artifact.repository.DefaultArtifactRepository; //导入依赖的package包/类
/**
 * Validate the generation of a java files from purchaseorder.xsd.
 * 
 * @throws MojoExecutionException
 */
public void testExecute() throws Exception {

	final File pom = new File(getBaseDir(),
	"src/test/resources/test-pom.xml");
	
       final ArtifactRepository localRepository = new DefaultArtifactRepository( "local", 
       		
       		new File(getBaseDir(), "target/test-repository").toURI().toURL().toString()        		, new DefaultRepositoryLayout());
	
	
	final MavenProject mavenProject = mavenProjectBuilder.build(pom, localRepository, null);
	

	final XJC21Mojo generator = (XJC21Mojo) lookupMojo("generate", pom);
	generator.setProject(mavenProject);
	generator.setLocalRepository(localRepository);
	generator.setSchemaDirectory(new File(getBaseDir(),"src/test/resources/"));
	generator.setSchemaIncludes(new String[] { "*.xsd" });
	generator.setBindingIncludes(new String[] { "*.xjb" });
	generator.setGenerateDirectory(new File(getBaseDir(), "target/test/generated-sources"));
	generator.setVerbose(true);
	generator.setGeneratePackage("unittest");
	generator.setRemoveOldOutput(false);
	
	generator.execute();
}
 
开发者ID:highsource,项目名称:maven-jaxb2-plugin,代码行数:32,代码来源:JAXBGenerateTest.java

示例12: testExecute

import org.apache.maven.artifact.repository.DefaultArtifactRepository; //导入依赖的package包/类
/**
 * Validate the generation of a java files from purchaseorder.xsd.
 * 
 * @throws MojoExecutionException
 */
public void testExecute() throws Exception {

	final File pom = new File(getBaseDir(),
	"src/test/resources/test-pom.xml");
	
       final ArtifactRepository localRepository = new DefaultArtifactRepository( "local", 
       		
       		new File(getBaseDir(), "target/test-repository").toURI().toURL().toString()        		, new DefaultRepositoryLayout());
	
	
	final MavenProject mavenProject = mavenProjectBuilder.build(pom, localRepository, null);
	

	final XJC2Mojo generator = (XJC2Mojo) lookupMojo("generate", pom);
	generator.setProject(mavenProject);
	generator.setLocalRepository(localRepository);
	generator.setSchemaDirectory(new File(getBaseDir(),"src/test/resources/"));
	generator.setSchemaIncludes(new String[] { "*.xsd" });
	generator.setBindingIncludes(new String[] { "*.xjb" });
	generator.setGenerateDirectory(new File(getBaseDir(), "target/test/generated-sources"));
	generator.setVerbose(true);
	generator.setGeneratePackage("unittest");
	generator.setRemoveOldOutput(false);
	
	generator.execute();
}
 
开发者ID:highsource,项目名称:maven-jaxb2-plugin,代码行数:32,代码来源:JAXBGenerateTest.java

示例13: createLocalArtifactRepository

import org.apache.maven.artifact.repository.DefaultArtifactRepository; //导入依赖的package包/类
@Override
protected ArtifactRepository createLocalArtifactRepository() {
    ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) lookup(ArtifactRepositoryLayout.ROLE, getLocalRepository().getLayout());
    return new DefaultArtifactRepository("local", tmpDirFactory.create().toURI().toString(), repositoryLayout);
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:6,代码来源:AntTaskBackedMavenPublisher.java

示例14: createLocalArtifactRepository

import org.apache.maven.artifact.repository.DefaultArtifactRepository; //导入依赖的package包/类
@Override
protected ArtifactRepository createLocalArtifactRepository() {
    ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) lookup(ArtifactRepositoryLayout.ROLE, getLocalRepository().getLayout());
    return new DefaultArtifactRepository("local", repoLocation, repositoryLayout);
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:6,代码来源:AntTaskBackedMavenLocalPublisher.java


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