+
+ // sources
+ if (sourcesProvider != null) {
+ IOUtils.closeQuietly(in);
+ in = new ByteArrayInputStream(out.toByteArray());
+ jar = new Jar(null, in);
+ List<String> packages = jar.getPackages();
+
+ IOUtils.closeQuietly(out);
+ out = new ByteArrayOutputStream();
+ sourcesProvider
+ .writeSources(packages, new ZipOutputStream(out));
+
+ IOUtils.closeQuietly(in);
+ in = new ByteArrayInputStream(out.toByteArray());
+ byte[] sourcesJar = RepoUtils.packageAsPdeSource(in,
+ new DefaultNameVersion(wrapper));
+ Artifact sourcesArtifact = new DefaultArtifact(
+ artifact.getGroupId(), artifact.getArtifactId()
+ + ".source", "jar", artifact.getVersion());
+ Node sourcesJarNode = RepoUtils.copyBytesAsArtifact(
+ javaSession.getRootNode(), sourcesArtifact, sourcesJar);
+ sourcesJarNode.getSession().save();
+
+ if (log.isDebugEnabled())
+ log.debug("Added sources " + sourcesArtifact
+ + " for bundle " + artifact);
+ }
+