private String workspace;
private String groupId;
private String artifactBasePath = "/";
- private String version = "1.3.0";
+ private String version = null;
+ private String parentPomCoordinates;
+
+ private List<String> excludedSuffixes = new ArrayList<String>();
private ArtifactIndexer artifactIndexer = new ArtifactIndexer();
private JarFileIndexer jarFileIndexer = new JarFileIndexer();
Set<Artifact> artifacts) throws RepositoryException {
Artifact artifact = new DefaultArtifact(groupId, artifactId, "pom",
version);
+ Artifact parentArtifact = parentPomCoordinates != null ? new DefaultArtifact(
+ parentPomCoordinates) : null;
String pom = MavenConventionsUtils.artifactsAsDependencyPom(artifact,
- artifacts);
+ artifacts, parentArtifact);
Node node = RepoUtils.copyBytesAsArtifact(
session.getNode(artifactBasePath), artifact, pom.getBytes());
artifactIndexer.index(node);
+
+ // FIXME factorize
+ String pomSha = JcrUtils.checksumFile(node, "SHA-1");
+ JcrUtils.copyBytesAsFile(node.getParent(), node.getName() + ".sha1",
+ pomSha.getBytes());
session.save();
return artifact;
}
if (symbolicName.endsWith(".source")) {
// TODO make a shared node with classifier 'sources'
+ String bundleName = RepoUtils
+ .extractBundleNameFromSourceName(symbolicName);
+ for (String excludedSuffix : excludedSuffixes) {
+ if (bundleName.endsWith(excludedSuffix))
+ return;// skip adding to sources
+ }
sources.add(RepoUtils.asArtifact(bundleNode));
return;
}
}
symbolicNamesToNodes.put(symbolicName, bundleNode);
+ for (String excludedSuffix : excludedSuffixes) {
+ if (symbolicName.endsWith(excludedSuffix))
+ return;// skip adding to binaries
+ }
binaries.add(RepoUtils.asArtifact(bundleNode));
+
+ if (bundleNode.getSession().hasPendingChanges())
+ bundleNode.getSession().save();
}
protected void processBundleArtifact(Node bundleNode)
String bundleSha = JcrUtils.checksumFile(bundleNode, "SHA-1");
JcrUtils.copyBytesAsFile(artifactFolder,
bundleNode.getName() + ".sha1", bundleSha.getBytes());
- String pomSha = JcrUtils.checksumFile(bundleNode, "SHA-1");
+ String pomSha = JcrUtils.checksumFile(pomNode, "SHA-1");
JcrUtils.copyBytesAsFile(artifactFolder, pomNode.getName() + ".sha1",
pomSha.getBytes());
}
dependenciesSymbolicNames.add(dependencySymbolicName);
} else {
if (!JcrUtils.check(importPackage, SLC_OPTIONAL)
- && !systemPackages.contains(importPackage))
+ && !systemPackages.contains(pkg))
log.warn("No bundle found for pkg " + pkg);
}
}
// Dependency management
p.append("<dependencyManagement>\n");
p.append("<dependencies>\n");
- // TODO import SDK
+ p.append("<dependency>\n");
+ p.append("\t<groupId>").append(groupId).append("</groupId>\n");
+ p.append("\t<artifactId>")
+ .append(ownSymbolicName.endsWith(".source") ? SOURCES_ARTIFACT_ID
+ : BINARIES_ARTIFACT_ID).append("</artifactId>\n");
+ p.append("\t<version>").append(version).append("</version>\n");
+ p.append("\t<type>pom</type>\n");
+ p.append("\t<scope>import</scope>\n");
+ p.append("</dependency>\n");
p.append("</dependencies>\n");
p.append("</dependencyManagement>\n");
this.groupId = groupId;
}
+ public void setParentPomCoordinates(String parentPomCoordinates) {
+ this.parentPomCoordinates = parentPomCoordinates;
+ }
+
+ public void setArtifactBasePath(String artifactBasePath) {
+ this.artifactBasePath = artifactBasePath;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public void setExcludedSuffixes(List<String> excludedSuffixes) {
+ this.excludedSuffixes = excludedSuffixes;
+ }
+
}