use of org.jetbrains.idea.maven.model.MavenRepositoryInfo in project intellij-community by JetBrains.
the class ArtifactoryRepositoryService method getRepositories.
@NotNull
@Override
public List<MavenRepositoryInfo> getRepositories(@NotNull String url) throws IOException {
try {
final Gson gson = new Gson();
final InputStreamReader stream = new InputStreamReader(new Endpoint.Repositories(url).getRepositoryDetailsListJson(null).getInputStream());
final ArtifactoryModel.RepositoryType[] repos = gson.fromJson(stream, ArtifactoryModel.RepositoryType[].class);
final List<MavenRepositoryInfo> result = new ArrayList<>(repos.length);
for (ArtifactoryModel.RepositoryType repo : repos) {
result.add(convert(repo));
}
return result;
} catch (JsonSyntaxException e) {
return Collections.emptyList();
} catch (Exception e) {
throw new IOException(e);
}
}
use of org.jetbrains.idea.maven.model.MavenRepositoryInfo in project intellij-community by JetBrains.
the class NexusRepositoryService method getRepositories.
@NotNull
@Override
public List<MavenRepositoryInfo> getRepositories(@NotNull String url) throws IOException {
try {
List<RepositoryType> repos = new Endpoint.Repositories(url).getRepolistAsRepositories().getData().getRepositoriesItem();
List<MavenRepositoryInfo> result = new ArrayList<>(repos.size());
for (RepositoryType repo : repos) {
if (!"maven2".equals(repo.getProvider()))
continue;
result.add(convertRepositoryInfo(repo));
}
return result;
} catch (UnmarshalException e) {
return Collections.emptyList();
} catch (JAXBException e) {
throw new IOException(e);
}
}
use of org.jetbrains.idea.maven.model.MavenRepositoryInfo in project intellij-community by JetBrains.
the class RepositoryAttachDialog method getRepositories.
@NotNull
public List<MavenRepositoryInfo> getRepositories() {
final Pair<MavenArtifactInfo, MavenRepositoryInfo> artifactAndRepo = myCoordinates.get(getCoordinateText());
final MavenRepositoryInfo repository = artifactAndRepo == null ? null : artifactAndRepo.second;
return repository != null ? Collections.singletonList(repository) : ContainerUtil.findAll(myRepositories.values(), Condition.NOT_NULL);
}
use of org.jetbrains.idea.maven.model.MavenRepositoryInfo in project intellij-community by JetBrains.
the class JUnit4IntegrationTest method before.
@Before
public void before() throws Throwable {
EdtTestUtil.runInEdtAndWait(() -> {
setUp();
Module module = createEmptyModule();
String communityPath = PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/');
String methodName = myNameRule.getMethodName();
methodName = methodName.substring(0, methodName.indexOf("["));
String testDataPath = communityPath + File.separator + "plugins" + File.separator + "junit5_rt_tests" + File.separator + "testData" + File.separator + "integration" + File.separator + methodName;
MavenId mavenId = new MavenId("junit", "junit", myJUnitVersion);
MavenRepositoryInfo repositoryInfo = new MavenRepositoryInfo("maven", "maven", "http://maven.labs.intellij.net/repo1");
RepositoryAttachHandler.doResolveInner(getProject(), mavenId, Collections.emptyList(), Collections.singleton(repositoryInfo), artifacts -> {
for (MavenArtifact artifact : artifacts) {
ModuleRootModificationUtil.addModuleLibrary(module, VfsUtilCore.pathToUrl(artifact.getPath()));
}
return true;
}, new DumbProgressIndicator());
ModuleRootModificationUtil.setModuleSdk(module, JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk());
ModuleRootModificationUtil.updateModel(module, model -> {
ContentEntry contentEntry = model.addContentEntry(VfsUtilCore.pathToUrl(testDataPath));
contentEntry.addSourceFolder(VfsUtilCore.pathToUrl(testDataPath + File.separator + "test"), true);
CompilerModuleExtension moduleExtension = model.getModuleExtension(CompilerModuleExtension.class);
moduleExtension.inheritCompilerOutputPath(false);
moduleExtension.setCompilerOutputPathForTests(VfsUtilCore.pathToUrl(testDataPath + File.separator + "out"));
});
});
}
Aggregations