diff --git a/carbon-p2-plugin/pom.xml b/carbon-p2-plugin/pom.xml
index 6055f044..1a7e2134 100755
--- a/carbon-p2-plugin/pom.xml
+++ b/carbon-p2-plugin/pom.xml
@@ -42,6 +42,7 @@ License. -->
org.apache.maven.plugins
maven-plugin-plugin
+ ${maven-plugin-plugin.version}
org.apache.maven.plugin-tools
diff --git a/carbon-p2-plugin/src/main/java/org/wso2/maven/p2/PublishProductMojo.java b/carbon-p2-plugin/src/main/java/org/wso2/maven/p2/PublishProductMojo.java
index aef1f937..fdfee6a7 100755
--- a/carbon-p2-plugin/src/main/java/org/wso2/maven/p2/PublishProductMojo.java
+++ b/carbon-p2-plugin/src/main/java/org/wso2/maven/p2/PublishProductMojo.java
@@ -72,11 +72,6 @@ public class PublishProductMojo extends AbstractMojo {
@Parameter(property = "productConfiguration")
private File productConfigurationFile;
-// /**
-// * Parsed product configuration file
-// */
-// private ProductConfiguration productConfiguration;
-
@Component
private IProvisioningAgent agent;
@@ -92,31 +87,22 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}
}
- private void publishProduct() throws Exception{
-
- //productConfiguration = ProductConfiguration.read( productConfigurationFile );
-
+ private void publishProduct() throws Exception{
ProductPublisherApplication application = new ProductPublisherApplication();
- Object result = application.run(getPublishProductConfigurations(productConfigurationFile.getCanonicalPath()));
+ Object result = application.run(getPublishProductConfigurations());
if (result != IApplication.EXIT_OK ) {
throw new MojoFailureException("P2 publisher return code was " + result);
}
}
- private String[] getPublishProductConfigurations(String confFileCanonicalPath) throws Exception {
+ private String[] getPublishProductConfigurations() throws Exception {
String[] result = new String[] {
- "-ar",
- String.format("%s", metadataRepository.toURI()),
- "-mr",
- String.format("%s", metadataRepository.toURI()),
- "-productFile",
- confFileCanonicalPath,
- "-executables",
- executable.toString(),
- "-configs",
- "gtk.linux.x86",
- "-flavor",
- "tooling",
+ "-ar",String.format("%s", metadataRepository.toURI()),
+ "-mr",String.format("%s", metadataRepository.toURI()),
+ "-productFile",productConfigurationFile.getCanonicalPath(),
+ "-executables",executable.toString(),
+ "-configs","gtk.linux.x86",
+ "-flavor","tooling",
"-append"
};
return result;
diff --git a/carbon-p2-plugin/src/main/java/org/wso2/maven/p2/RepositoryGenMojo.java b/carbon-p2-plugin/src/main/java/org/wso2/maven/p2/RepositoryGenMojo.java
index 4e4591c5..734b1343 100755
--- a/carbon-p2-plugin/src/main/java/org/wso2/maven/p2/RepositoryGenMojo.java
+++ b/carbon-p2-plugin/src/main/java/org/wso2/maven/p2/RepositoryGenMojo.java
@@ -367,8 +367,7 @@ private void updateRepositoryWithCategories() throws Exception {
if (!isCategoriesAvailable()) {
return;
} else {
- P2Utils.createCategoryFile(getProject(), categories, categoryDefinitionFile,
- repoSystem, repoSession, remotePluginRepos /*remoteRepositories*/);
+ P2Utils.createCategoryFile(getProject(), categories, categoryDefinitionFile);
CategoryPublisherApplication application = new CategoryPublisherApplication();
Object result = application.run(getUpdateRepositoryConfigurations());
diff --git a/carbon-p2-plugin/src/main/java/org/wso2/maven/p2/generate/utils/P2Utils.java b/carbon-p2-plugin/src/main/java/org/wso2/maven/p2/generate/utils/P2Utils.java
index 07067f44..0d3c7bf2 100755
--- a/carbon-p2-plugin/src/main/java/org/wso2/maven/p2/generate/utils/P2Utils.java
+++ b/carbon-p2-plugin/src/main/java/org/wso2/maven/p2/generate/utils/P2Utils.java
@@ -86,10 +86,10 @@ public static void setupLauncherLocation(P2Profile p2Profile, File p2LauncherDir
}
//TODO: Where is this static method called from?
- public static ArrayList getProcessedP2LanucherFiles(ArrayList processedP2LauncherFiles, EquinoxLauncher equinoxLauncher, MavenProject project,RepositorySystem repoSystem, RepositorySystemSession repoSession, List remoteRepositories) throws MojoExecutionException {
+ public static ArrayList getProcessedP2LanucherFiles(ArrayList processedP2LauncherFiles, EquinoxLauncher equinoxLauncher, MavenProject project,RepositorySystem repoSystem, RepositorySystemSession repoSession, List remoteRepositories) throws MojoExecutionException {
if (processedP2LauncherFiles != null)
return processedP2LauncherFiles;
- processedP2LauncherFiles = new ArrayList();
+ processedP2LauncherFiles = new ArrayList();
RepoSystemHolder repoRefs = new RepoSystemHolder(repoSystem, repoSession, remoteRepositories);
Iterator iter = equinoxLauncher.getLauncherFiles().iterator();
while (iter.hasNext()) {
@@ -161,10 +161,11 @@ public static String getEquinoxLauncherJarLocation(File p2AgentDir) throws Excep
}
for (File file : listFiles) {
- JarFile jarFile = new JarFile(file);
- String symbolicName = jarFile.getManifest().getMainAttributes().getValue(Bundle.BUNDLE_SYMBOLIC_NAME);
- if (symbolicName != null && symbolicName.equals("org.eclipse.equinox.launcher")) {
- return file.getAbsolutePath();
+ try (JarFile jarFile = new JarFile(file)){
+ String symbolicName = jarFile.getManifest().getMainAttributes().getValue(Bundle.BUNDLE_SYMBOLIC_NAME);
+ if (symbolicName != null && symbolicName.equals("org.eclipse.equinox.launcher")) {
+ return file.getAbsolutePath();
+ }
}
}
//launcher jar is not found.
@@ -195,9 +196,9 @@ public static boolean isPatch(String matchStr){
return matchStr.equalsIgnoreCase("patch");
}
- public static void createCategoryFile(MavenProject project, ArrayList categories, File categoryFile, RepositorySystem repoSystem, RepositorySystemSession repoSession, List remoteRepositories )throws Exception {
+ public static void createCategoryFile(MavenProject project, ArrayList categories, File categoryFile) throws MojoExecutionException {
- Map featureCategories=new HashMap();
+ Map> featureCategories=new HashMap<>();
Document doc = MavenUtils.getManifestDocument();
Element rootElement = doc.getDocumentElement();
@@ -219,13 +220,19 @@ public static void createCategoryFile(MavenProject project, ArrayList categories
categoryDef.appendChild(descriptionElement);
ArrayList processedFeatures = cat.getProcessedFeatures(project);
for (CatFeature feature : processedFeatures) {
+ List list = null;
if (!featureCategories.containsKey(feature.getId()+feature.getVersion())){
- ArrayList list = new ArrayList();
+ //No value for "feature.getId()+feature.getVersion()",
+ //Add the value as a List containing only the current CatFeature
+ list = new ArrayList<>();
+ list.add(feature);
featureCategories.put((feature.getId()+feature.getVersion()), list);
+ } else {
+ //Value found for "feature.getId()+feature.getVersion()",
+ //Add the current CatFeature to the existing CatFeatures
+ list = featureCategories.get(feature.getId()+feature.getVersion());
list.add(feature);
}
- ArrayList list = (ArrayList)featureCategories.get(feature.getId()+feature.getVersion());
- list.add(cat.getId());
}
}
}