private static Processor asProcessor(Map<String, String> b) { Processor p = new Processor(); p.addProperties(b); return p; }
private static Processor asProcessor(Map<String, String> b) { Processor p = new Processor(); p.addProperties(b); return p; }
private PomResource createPomFromFirstMavenPropertiesInJar(Jar jar, Processor context) throws IOException, Exception { for (Map.Entry<String, Resource> e : jar.getResources() .entrySet()) { String path = e.getKey(); if (path.startsWith("META-INF/maven/") && path.endsWith("/pom.properties")) { Resource r = e.getValue(); UTF8Properties utf8p = new UTF8Properties(); utf8p.load(r.openInputStream()); String version = utf8p.getProperty("version"); String artifactId = utf8p.getProperty("artifactId"); String groupId = utf8p.getProperty("groupId"); try (Processor ctx = new Processor(context)) { ctx.addProperties(utf8p); return new PomResource(ctx, jar.getManifest(), groupId, artifactId, version); } } } return null; }
private PomResource createPomFromFirstMavenPropertiesInJar(Jar jar, Processor context) throws IOException, Exception { for (Map.Entry<String, Resource> e : jar.getResources() .entrySet()) { String path = e.getKey(); if (path.startsWith("META-INF/maven/") && path.endsWith("/pom.properties")) { Resource r = e.getValue(); UTF8Properties utf8p = new UTF8Properties(); utf8p.load(r.openInputStream()); String version = utf8p.getProperty("version"); String artifactId = utf8p.getProperty("artifactId"); String groupId = utf8p.getProperty("groupId"); try (Processor ctx = new Processor(context)) { ctx.addProperties(utf8p); return new PomResource(ctx, jar.getManifest(), groupId, artifactId, version); } } } return null; }
void doPom(Jar dot) throws Exception, IOException { try (Processor scoped = new Processor(this)) { String bsn = getBsn(); if (bsn != null) scoped.setProperty("@bsn", bsn); String version = getBundleVersion(); if (version != null) scoped.setProperty("@version", version); String pom = scoped.getProperty(POM); if (pom != null && !pom.equalsIgnoreCase("false")) { dot.removePrefix("META-INF/maven/"); scoped.addProperties(OSGiHeader.parseProperties(pom)); PomResource pomXml = new PomResource(scoped, dot.getManifest()); String v = pomXml.validate(); if (v != null) { error("Invalid pom for %s: %s", getBundleSymbolicName(), v); } PomPropertiesResource pomProperties = new PomPropertiesResource(pomXml); dot.putResource(pomXml.getWhere(), pomXml); if (!pomProperties.getWhere() .equals(pomXml.getWhere())) { dot.putResource(pomProperties.getWhere(), pomProperties); } } } }
void doPom(Jar dot) throws Exception, IOException { try (Processor scoped = new Processor(this)) { String bsn = getBsn(); if (bsn != null) scoped.setProperty("@bsn", bsn); String version = getBundleVersion(); if (version != null) scoped.setProperty("@version", version); String pom = scoped.getProperty(POM); if (pom != null && !pom.equalsIgnoreCase("false")) { dot.removePrefix("META-INF/maven/"); scoped.addProperties(OSGiHeader.parseProperties(pom)); PomResource pomXml = new PomResource(scoped, dot.getManifest()); String v = pomXml.validate(); if (v != null) { error("Invalid pom for %s: %s", getBundleSymbolicName(), v); } PomPropertiesResource pomProperties = new PomPropertiesResource(pomXml); dot.putResource(pomXml.getWhere(), pomXml); if (!pomProperties.getWhere() .equals(pomXml.getWhere())) { dot.putResource(pomProperties.getWhere(), pomProperties); } } } }