use of org.jetbrains.idea.maven.model.MavenId in project android by JetBrains.
the class AndroidFacetImporterBase method resolve.
@Override
public void resolve(final Project project, MavenProject mavenProject, NativeMavenProjectHolder nativeMavenProject, MavenEmbedderWrapper embedder, ResolveContext context) throws MavenProcessCanceledException {
final AndroidExternalApklibDependenciesManager adm = AndroidExternalApklibDependenciesManager.getInstance(project);
for (MavenArtifact depArtifact : mavenProject.getDependencies()) {
final MavenProjectsManager mavenProjectsManager = MavenProjectsManager.getInstance(project);
if (AndroidMavenUtil.APKLIB_DEPENDENCY_AND_PACKAGING_TYPE.equals(depArtifact.getType()) && mavenProjectsManager.findProject(depArtifact) == null && MavenConstants.SCOPE_COMPILE.equals(depArtifact.getScope())) {
Set<MavenId> resolvedArtifacts = context.getUserData(RESOLVED_APKLIB_ARTIFACTS_KEY);
if (resolvedArtifacts == null) {
resolvedArtifacts = new HashSet<MavenId>();
context.putUserData(RESOLVED_APKLIB_ARTIFACTS_KEY, resolvedArtifacts);
}
if (resolvedArtifacts.add(depArtifact.getMavenId())) {
doResolveApklibArtifact(project, depArtifact, embedder, mavenProjectsManager, mavenProject.getName(), adm, context);
}
}
}
}
use of org.jetbrains.idea.maven.model.MavenId in project intellij-plugins by JetBrains.
the class Flexmojos3Configurator method ensureSdkHasRequiredAdditionalJarPaths.
private void ensureSdkHasRequiredAdditionalJarPaths(@NotNull final Sdk sdk) {
assert sdk.getSdkType() instanceof FlexmojosSdkType;
final FlexmojosSdkAdditionalData additionalData = ((FlexmojosSdkAdditionalData) sdk.getSdkAdditionalData());
assert additionalData != null;
for (MavenId dependency : myFlexmojosPlugin.getDependencies()) {
if (StringUtil.isEmpty(dependency.getArtifactId()))
continue;
for (Pattern jarNamePattern : ADDITIONAL_JAR_NAME_PATTERNS_TO_INCLUDE_IN_FLEXMOJOS_SDK_CLASSPATH) {
if (jarNamePattern.matcher(dependency.getArtifactId()).matches()) {
final String jarFilePath = getArtifactFilePath(myMavenProject, dependency, MavenConstants.TYPE_JAR);
additionalData.addFlexCompilerClasspathEntryIfNotPresentAndRemoveDifferentVersionOfThisJar(jarNamePattern, jarFilePath);
break;
}
}
}
}
use of org.jetbrains.idea.maven.model.MavenId in project intellij-plugins by JetBrains.
the class Flexmojos4GenerateConfigTask method writeWorkspaceMap.
private void writeWorkspaceMap(final Collection<MavenProject> mavenProjects) throws IOException {
int actualLength = 0;
for (MavenProject mavenProject : mavenProjects) {
if (ArrayUtil.contains(mavenProject.getPackaging(), FlexmojosImporter.SUPPORTED_PACKAGINGS)) {
actualLength++;
}
}
out.writeShort(actualLength);
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed") ObjectOutputStream objectOutputStream = new ObjectOutputStream(out);
for (MavenProject mavenProject : mavenProjects) {
if (!ArrayUtil.contains(mavenProject.getPackaging(), FlexmojosImporter.SUPPORTED_PACKAGINGS)) {
continue;
}
final MavenId mavenId = mavenProject.getMavenId();
objectOutputStream.writeObject(mavenId.getGroupId());
objectOutputStream.writeObject(mavenId.getArtifactId());
objectOutputStream.writeObject(mavenId.getVersion());
objectOutputStream.writeObject(mavenProject.getFile().getPath());
}
objectOutputStream.flush();
}
use of org.jetbrains.idea.maven.model.MavenId in project intellij-plugins by JetBrains.
the class OsmorcFacetImporter method computeSymbolicName.
/**
* Computes the Bundle-SymbolicName value from the data given in the maven project.
*/
@NotNull
private String computeSymbolicName(MavenProject mavenProject) {
String bundleSymbolicName = findConfigValue(mavenProject, "instructions." + Constants.BUNDLE_SYMBOLICNAME);
if (!StringUtil.isEmpty(bundleSymbolicName)) {
return bundleSymbolicName;
}
MavenId mavenId = mavenProject.getMavenId();
String groupId = mavenId.getGroupId();
String artifactId = mavenId.getArtifactId();
if (groupId == null || artifactId == null) {
return "";
}
// if artifactId is equal to last section of groupId then groupId is returned (org.apache.maven:maven -> org.apache.maven)
String lastSectionOfGroupId = groupId.substring(groupId.lastIndexOf(".") + 1);
if (lastSectionOfGroupId.endsWith(artifactId)) {
return groupId;
}
// if artifactId starts with last section of groupId that portion is removed (org.apache.maven:maven-core -> org.apache.maven.core)
String doubledNamePart = lastSectionOfGroupId + "-";
if (artifactId.startsWith(doubledNamePart) && artifactId.length() > doubledNamePart.length()) {
return groupId + "." + artifactId.substring(doubledNamePart.length());
}
return groupId + "." + artifactId;
}
Aggregations