private RepoUtils() {
}
+
+ /** If a source return the base bundle name, does not change otherwise */
+ public static String extractBundleNameFromSourceName(String sourceBundleName) {
+ if (sourceBundleName.endsWith(".source"))
+ return sourceBundleName.substring(0, sourceBundleName.length()
+ - ".source".length());
+ else
+ return sourceBundleName;
+ }
}
// XML header
p.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
p.append("<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n");
- p.append("<modelVersion>4.0.0</modelVersion>");
+ p.append("<modelVersion>4.0.0</modelVersion>\n");
// Artifact
if (parent != null) {
p.append("</dependencyManagement>\n");
// Repositories
- p.append("<repositories>\n");
- p.append("<repository><id>argeo</id><url>http://maven.argeo.org/argeo</url></repository>\n");
- p.append("</repositories>\n");
+// p.append("<repositories>\n");
+// p.append("<repository><id>argeo</id><url>http://maven.argeo.org/argeo</url></repository>\n");
+// p.append("</repositories>\n");
p.append("</project>\n");
return p.toString();
import org.argeo.slc.repo.ArtifactIndexer;
import org.argeo.slc.repo.JarFileIndexer;
import org.argeo.slc.repo.RepoUtils;
-import org.argeo.slc.repo.maven.MavenConventionsUtils;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.util.artifact.DefaultArtifact;
session = repository.login(workspace);
// clear
- String groupPath = MavenConventionsUtils.groupPath(
- artifactBasePath, groupId);
- if (session.itemExists(groupPath)) {
- session.getNode(groupPath).remove();
- session.save();
- if (log.isDebugEnabled())
- log.debug("Cleared " + groupPath);
- }
+ // String groupPath = MavenConventionsUtils.groupPath(
+ // artifactBasePath, groupId);
+ // if (session.itemExists(groupPath)) {
+ // session.getNode(groupPath).remove();
+ // session.save();
+ // if (log.isDebugEnabled())
+ // log.debug("Cleared " + groupPath);
+ // }
zipIn = new ZipInputStream(url.openStream());
ZipEntry zipEntry = null;
continue entries;
}
+ String bundleName = RepoUtils.extractBundleNameFromSourceName(nv
+ .getName());
// skip excluded bundles and their sources
- if (excludedBundles.contains(extractBundleNameFromSourceName(nv
- .getName())))
+ if (excludedBundles.contains(bundleName))
continue entries;
+ // for(String excludedBundle:excludedBundles){
+ // if(bundleName.contains(excludedBundle))
+ // continue entries;
+ // }
Artifact artifact = new DefaultArtifact(groupId, nv.getName(),
"jar", nv.getVersion());
}
- /** If a source return the base bundle name, does not change otherwise */
- private String extractBundleNameFromSourceName(String sourceBundleName) {
- if (sourceBundleName.endsWith(".source"))
- return sourceBundleName.substring(0, sourceBundleName.length()
- - ".source".length());
- else
- return sourceBundleName;
- }
-
public void setRepository(Repository repository) {
this.repository = repository;
}
private String workspace;
private String groupId;
private String artifactBasePath = "/";
- private String version = "1.3.0";
- private String parentPomCoordinates = "org.argeo:parent:1.3.0";
+ private String version = null;// = "1.3.0";
+ private String parentPomCoordinates;// = "org.argeo:parent:1.3.0";
+
+ 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, new DefaultArtifact(parentPomCoordinates));
+ artifacts, parentArtifact);
Node node = RepoUtils.copyBytesAsArtifact(
session.getNode(artifactBasePath), artifact, pom.getBytes());
artifactIndexer.index(node);
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));
}
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;
+ }
+
}