List of usage examples for org.apache.maven.project MavenProject getVersion
public String getVersion()
From source file:org.universAAL.support.directives.procedures.Tag.java
License:Apache License
/** {@inheritDoc} */ public void execute(MavenProject mavenProject, Log log) throws MojoExecutionException, MojoFailureException { if (baseURL == null) { baseURL = mavenProject.getScm().getDeveloperConnection(); }/*from ww w. j ava2s.c om*/ String tagUrl = getTagURL(mavenProject); log.info("Tagging: " + baseURL + " -> " + tagUrl); if (tagRemoteHead) { if (!performTag(baseURL, tagUrl, "Automatic tag of " + mavenProject.getArtifactId() + " version: " + mavenProject.getVersion())) { throw new MojoExecutionException(NOT_TAGGED); } } else { if (!performWCTag(mavenProject.getBasedir(), tagUrl, "Automatic tag of " + mavenProject.getArtifactId() + " version: " + mavenProject.getVersion())) { throw new MojoExecutionException(NOT_TAGGED); } } }
From source file:org.universAAL.support.directives.procedures.Tag.java
License:Apache License
/** * parses the scm url to generate an appropiate tag URL, in concordance to * T2.3 Directives// w w w. j av a 2s. c o m * * @return */ public static String getTagURL(MavenProject mavenProject) { String scmUrl = mavenProject.getScm().getDeveloperConnection(); scmUrl = scmUrl.replace("scm:", "").replace("svn:", ""); String tagUrl = scmUrl.split("trunk")[0]; tagUrl += "tags/"; if (AbstractCheckMojo.isSnapshot(mavenProject)) { tagUrl += "SNAPSHOT/" + mavenProject.getArtifactId() + "-" + mavenProject.getVersion(); } else { tagUrl += mavenProject.getVersion() + scmUrl.split("trunk")[1]; } return tagUrl; }
From source file:org.universaal.tools.buildserviceapplication.actions.CreateLaunchConfigurationFile.java
License:Apache License
public ILaunchConfiguration createLaunchConfiguration() { try {//from w ww . ja v a 2 s .c om ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType type = manager .getLaunchConfigurationType("org.eclipse.pde.ui.EquinoxLauncher"); ILaunchConfigurationWorkingCopy wc = type.newInstance(null, getArtifactId()); wc.setAttribute("append.args", true); wc.setAttribute("automaticAdd", true); wc.setAttribute("automaticValidate", false); wc.setAttribute("bootstrap", ""); wc.setAttribute("checked", "[NONE]"); wc.setAttribute("clearConfig", false); wc.setAttribute("configLocation", "${workspace_loc}/rundir/" + getArtifactId()); wc.setAttribute("default", true); wc.setAttribute("default_auto_start", true); wc.setAttribute("default_start_level", 8); wc.setAttribute("includeOptional", true); wc.setAttribute("org.eclipse.debug.core.source_locator_id", "org.eclipse.pde.ui.launcher.PDESourceLookupDirector"); // wc.setAttribute( // "org.eclipse.debug.core.source_locator_memento", // "<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;folder nest=&quot;false&quot; path=&quot;/mw.bus.context/src/main/java&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.folder"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;folder nest=&quot;false&quot; path=&quot;/mw.bus.model/src/main/java&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.folder"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;folder nest=&quot;false&quot; path=&quot;/mw.bus.service/src/main/java&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.folder"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;folder nest=&quot;false&quot; path=&quot;/mw.data.representation/src/main/java&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.folder"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;folder nest=&quot;false&quot; path=&quot;/mw.data.serialization/src/main/java&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.folder"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;folder nest=&quot;false&quot; path=&quot;/ont.lighting/src/main/java&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.folder"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;folder nest=&quot;false&quot; path=&quot;/ont.phWorld/src/main/java&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.folder"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;folder nest=&quot;false&quot; path=&quot;/smp.lighting.client/src/main/java&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.folder"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;folder nest=&quot;false&quot; path=&quot;/smp.lighting.server/src/main/java&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.folder"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "); wc.setAttribute("includeOptional", true); wc.setAttribute("org.eclipse.jdt.launching.JRE_CONTAINER", "org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"); wc.setAttribute("org.eclipse.jdt.launching.PROGRAM_ARGUMENTS", "-console --obrRepositories=http://depot.universaal.org/nexus/content/repositories/snapshots/repository.xml,http://depot.universaal.org/nexus/content/repositories/releases/repository.xml,http://bundles.osgi.org/obr/browse?_xml=1&amp;cmd=repository --org.ops4j.pax.url.mvn.repositories=+http://depot.universaal.org/nexus/content/groups/public,http://depot.universaal.org/nexus/content/repositories/snapshots@snapshots@noreleases --log=DEBUG"); wc.setAttribute("org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER", "org.eclipse.pde.ui.workbenchClasspathProvider"); wc.setAttribute("org.eclipse.jdt.launching.VM_ARGUMENTS", "-Dosgi.noShutdown=true -Dfelix.log.level=4 -Dorg.universAAL.middleware.peer.is_coordinator=true -Dorg.universAAL.middleware.peer.member_of=urn:org.universAAL.aal_space:test_env -Dbundles.configuration.location=${workspace_loc}/rundir/confadmin"); wc.setAttribute("includeOptional", true); wc.setAttribute("org.eclipse.jdt.launching.WORKING_DIRECTORY", "${workspace_loc}/rundir/" + getSelectedMavenProject().getArtifactId()); wc.setAttribute("org.ops4j.pax.cursor.hotDeployment", false); wc.setAttribute("org.ops4j.pax.cursor.logLevel", "DEBUG"); wc.setAttribute("org.ops4j.pax.cursor.overwrite", false); wc.setAttribute("org.ops4j.pax.cursor.overwriteSystemBundles", false); wc.setAttribute("org.ops4j.pax.cursor.overwriteUserBundles", false); ArrayList classpath = new ArrayList(); classpath.add("obr"); wc.setAttribute("org.ops4j.pax.cursor.profiles", classpath); List<Dependency> deps = getProjectDependencies(); Map map = new HashMap(); map.put("mvn:org.apache.felix/org.apache.felix.configadmin/1.2.4", "true@true@2@false"); Dependency dep = getDependency("mw.acl.interfaces"); if (dep == null) { map.put("mvn:org.universAAL.middleware/mw.acl.interfaces", "true@true@2@false"); } else { map.put("mvn:org.universAAL.middleware/mw.acl.interfaces/" + dep.getVersion(), "true@true@2@false"); deps.remove(getDependency("mw.acl.interfaces")); } dep = getDependency("mw.bus.context"); if (dep == null) { map.put("mvn:org.universAAL.middleware/mw.bus.context", "true@true@4@true"); } else { map.put("mvn:org.universAAL.middleware/mw.bus.context/" + dep.getVersion(), "true@true@4@true"); deps.remove(getDependency("mw.bus.context")); } dep = getDependency("mw.bus.model"); if (dep == null) { map.put("mvn:org.universAAL.middleware/mw.bus.model", "true@true@3@true"); } else { map.put("mvn:org.universAAL.middleware/mw.bus.model/" + dep.getVersion(), "true@true@3@true"); deps.remove(getDependency("mw.bus.model")); } dep = getDependency("mw.bus.service"); if (dep == null) { map.put("mvn:org.universAAL.middleware/mw.bus.service", "true@true@4@true"); } else { map.put("mvn:org.universAAL.middleware/mw.bus.service/" + dep.getVersion(), "true@true@4@true"); deps.remove(getDependency("mw.bus.service")); } dep = getDependency("mw.data.representation"); if (dep == null) { map.put("mvn:org.universAAL.middleware/mw.data.representation", "true@true@4@true"); } else { map.put("mvn:org.universAAL.middleware/mw.data.representation/" + dep.getVersion(), "true@true@4@true"); deps.remove(getDependency("mw.data.representation")); } dep = getDependency("mw.data.serialization"); if (dep == null) { map.put("mvn:org.universAAL.middleware/mw.data.serialization", "true@true@4@true"); } else { map.put("mvn:org.universAAL.middleware/mw.data.serialization/" + dep.getVersion(), "true@true@4@true"); deps.remove(getDependency("mw.data.serialization")); } List<Dependency> ontDep = getGroupDependencies("org.universAAL.ontology"); for (int i = 0; i < ontDep.size(); i++) { map.put("mvn:org.universAAL.ontology/" + ontDep.get(i).getArtifactId() + "/" + ontDep.get(i).getVersion(), "true@true@5@false"); deps.remove(getDependency(ontDep.get(i).getArtifactId())); } for (int i = 0; i < deps.size(); i++) { if (deps.get(i).getGroupId().startsWith("org.universAAL.")) { map.put("mvn:" + deps.get(i).getGroupId() + "/" + deps.get(i).getArtifactId() + "/" + deps.get(i).getVersion(), "true@true@4@true"); } } // map.put("mvn:org.universAAL.ontology/ont.lighting", // "true@true@5@false"); // map.put("mvn:org.universAAL.ontology/ont.phWorld", // "true@true@5@false"); MavenProject mavenProject = getSelectedMavenProject(); map.put("mvn:" + mavenProject.getGroupId() + "/" + mavenProject.getArtifactId() + "/" + mavenProject.getVersion(), "true@false@7@true"); map.put("wrap:mvn:java3d/j3d-core/1.3.1", "true@true@2@false"); map.put("wrap:mvn:java3d/vecmath/1.3.1", "true@true@2@false"); map.put("wrap:mvn:jp.go.ipa/jgcl/1.0", "true@true@2@false"); map.put("wrap:mvn:org.bouncycastle/jce.jdk13/144", "true@true@2@false"); map.put("wrap:mvn:org.ops4j.pax.confman/pax-confman-propsloader/0.2.2", "true@true@3@false"); map.put("wrap:mvn:org.ops4j.pax.logging/pax-logging-api/1.6.0", "true@true@2@false"); map.put("wrap:mvn:org.ops4j.pax.logging/pax-logging-service/1.6.0", "true@true@3@false"); map.put("wrap:mvn:org.osgi/osgi_R4_compendium/1.0", "true@true@2@false"); wc.setAttribute("org.ops4j.pax.cursor.provisionItems", map); deps = getProjectDependencies(); classpath = new ArrayList(); classpath.add("--overwrite=false"); classpath.add("--overwriteUserBundles=false"); classpath.add("--overwriteSystemBundles=false"); classpath.add("--hotDeployment=false"); classpath.add("--log=DEBUG"); classpath.add("--profiles=obr"); classpath.add("mvn:org.apache.felix/org.apache.felix.configadmin/1.2.4@2"); dep = getDependency("mw.acl.interfaces"); if (dep == null) { classpath.add("mvn:org.universAAL.middleware/mw.acl.interfaces@2"); } else { classpath.add("mvn:org.universAAL.middleware/mw.acl.interfaces/" + dep.getVersion() + "@2"); deps.remove(getDependency("mw.acl.interfaces")); } classpath.add("wrap:mvn:jp.go.ipa/jgcl/1.0@2"); classpath.add("wrap:mvn:java3d/vecmath/1.3.1@2"); classpath.add("wrap:mvn:org.bouncycastle/jce.jdk13/144@2"); classpath.add("wrap:mvn:java3d/j3d-core/1.3.1@2"); classpath.add("wrap:mvn:org.osgi/osgi_R4_compendium/1.0@2"); classpath.add("wrap:mvn:org.ops4j.pax.logging/pax-logging-api/1.6.3@2"); classpath.add("wrap:mvn:org.ops4j.pax.confman/pax-confman-propsloader/0.2.2@3"); classpath.add("wrap:mvn:org.ops4j.pax.logging/pax-logging-service/1.6.3@3"); dep = getDependency("mw.bus.model"); if (dep == null) { classpath.add("mvn:org.universAAL.middleware/mw.bus.model@3@update"); } else { classpath.add("mvn:org.universAAL.middleware/mw.bus.model/" + dep.getVersion() + "@3@update"); deps.remove(getDependency("mw.bus.model")); } dep = getDependency("mw.bus.context"); if (dep == null) { classpath.add("mvn:org.universAAL.middleware/mw.bus.context@4@update"); } else { classpath.add("mvn:org.universAAL.middleware/mw.bus.context/" + dep.getVersion() + "@4@update"); deps.remove(getDependency("mw.bus.context")); } dep = getDependency("mw.bus.service"); if (dep == null) { classpath.add("mvn:org.universAAL.middleware/mw.bus.service@4@update"); } else { classpath.add("mvn:org.universAAL.middleware/mw.bus.service/" + dep.getVersion() + "@4@update"); deps.remove(getDependency("mw.bus.service")); } dep = getDependency("mw.data.serialization"); if (dep == null) { classpath.add("mvn:org.universAAL.middleware/mw.data.serialization@4@update"); } else { classpath.add( "mvn:org.universAAL.middleware/mw.data.serialization/" + dep.getVersion() + "@4@update"); deps.remove(getDependency("mw.data.serialization")); } dep = getDependency("mw.data.representation"); if (dep == null) { classpath.add("mvn:org.universAAL.middleware/mw.data.representation@4@update"); } else { classpath.add( "mvn:org.universAAL.middleware/mw.data.representation/" + dep.getVersion() + "@4@update"); deps.remove(getDependency("mw.data.representation")); } for (int i = 0; i < ontDep.size(); i++) { classpath.add("mvn:org.universAAL.ontology/" + ontDep.get(i).getArtifactId() + "/" + ontDep.get(i).getVersion() + "@5"); deps.remove(getDependency(ontDep.get(i).getArtifactId())); } for (int i = 0; i < deps.size(); i++) { if (deps.get(i).getGroupId().startsWith("org.universAAL.")) { classpath.add("mvn:" + deps.get(i).getGroupId() + "/" + deps.get(i).getArtifactId() + "/" + deps.get(i).getVersion() + "@4@update"); } } classpath.add("mvn:" + mavenProject.getGroupId() + "/" + mavenProject.getArtifactId() + "/" + mavenProject.getVersion() + "@6@nostart@update"); wc.setAttribute("org.ops4j.pax.cursor.runArguments", classpath); wc.setAttribute("osgi_framework_id", "--platform=felix --version=1.4.0"); wc.setAttribute("pde.version", "3.3"); wc.setAttribute("show_selected_only", false); wc.setAttribute("tracing", false); wc.setAttribute("useCustomFeatures", false); wc.setAttribute("useDefaultConfigArea", false); ILaunchConfiguration config = wc.doSave(); return config; } catch (Exception ex) { ex.printStackTrace(); return null; } }
From source file:org.universaal.uaalpax.ui.WorkspaceProjectsBlock.java
License:Apache License
public BundleSet updateProjectList(BundleSet launchProjects) { IWorkspaceRoot myWorkspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IProject[] projects = myWorkspaceRoot.getProjects(); Set<BundleEntry> leftSet = new HashSet<BundleEntry>(projects.length), rightSet = new HashSet<BundleEntry>(projects.length); for (IProject p : projects) { // leftProjects.add(new ProjectURL(p.getName(), 5, true)); IResource pom = p.findMember("pom.xml"); if (pom != null && pom.exists() && pom.getType() == IResource.FILE) { IFile pomFile = (IFile) pom; try { Model model = null;/*from www . j av a 2 s .co m*/ MavenXpp3Reader mavenreader = new MavenXpp3Reader(); model = mavenreader.read(pomFile.getContents()); model.setPomFile(pomFile.getFullPath().toFile()); MavenProject project = new MavenProject(model); LaunchURL launchUrl = new LaunchURL("mvn:" + project.getGroupId() + "/" + project.getArtifactId() + "/" + project.getVersion()); BundleEntry pu = new BundleEntry(launchUrl, p.getName(), 12, true); leftSet.add(pu); } catch (CoreException e) { System.out.println("Failed to parse " + p.getName() + ": " + e); } catch (IOException e) { System.out.println("Failed to parse " + p.getName() + ": " + e); } catch (XmlPullParserException e) { System.out.println("Failed to parse " + p.getName() + ": " + e); } } } BundleSet remainingProjects = new BundleSet(launchProjects); // now all workspace projects are in leftTable // put items to right table if they are contained in launch config for (BundleEntry e : launchProjects) { try { String launchURL = e.getArtifactUrl().url; // check if this launch url corresponds to a project in workspace for (Iterator<BundleEntry> iter = leftSet.iterator(); iter.hasNext();) { BundleEntry pu = iter.next(); // startsWith ensures that the test passes if the version is not entered in launchUrl try { if (pu.getArtifactUrl().url.startsWith(launchURL)) { iter.remove(); rightSet.add(new BundleEntry(pu.getProjectName(), e.getLaunchUrl(), e.getOptions())); remainingProjects.remove(e); } } catch (UnknownBundleFormatException e1) { // should never happen since bundles from left list should always be maven bundles } } } catch (UnknownBundleFormatException e1) { // ignore launch bundle if not artifact } } leftTable.removeAll(); leftTable.addAll(leftSet); rightTable.removeAll(); rightTable.addAll(rightSet); return remainingProjects; }
From source file:org.whitesource.bamboo.agent.MavenOssInfoExtractor.java
License:Apache License
private Coordinates extractCoordinates(MavenProject mavenProject) { return new Coordinates(mavenProject.getGroupId(), mavenProject.getArtifactId(), mavenProject.getVersion()); }
From source file:org.wildfly.swarm.plugin.MavenDependenciesResolver.java
License:Apache License
private File mockPom(MavenProject project) throws IOException { File pom = File.createTempFile("pom", ".xml"); pom.deleteOnExit();/* w ww . j a v a 2 s . c om*/ InputStream templateStream = getClass().getResourceAsStream("/pom-template.xml"); try (InputStreamReader streamReader = new InputStreamReader(templateStream); BufferedReader reader = new BufferedReader(streamReader); FileWriter writer = new FileWriter(pom)) { String line; while ((line = reader.readLine()) != null) { line = line.replace("FRACTION_GROUP_ID", project.getGroupId()); line = line.replace("FRACTION_ARTIFACT_ID", project.getArtifactId()); line = line.replace("FRACTION_VERSION", project.getVersion()); writer.write(line); } } return pom; }
From source file:org.wisdom.maven.mojos.RunMojo.java
License:Apache License
private MavenSession getMavenSession(final MavenProject project, MavenExecutionRequest request) { MavenSession newSession = new MavenSession(container, session.getRepositorySession(), request, session.getResult());// w ww . jav a2 s .c o m newSession.setAllProjects(session.getAllProjects()); newSession.setCurrentProject(project); newSession.setParallel(session.isParallel()); // Update project map to update the current project Map<String, MavenProject> projectMaps = new LinkedHashMap<>(session.getProjectMap()); projectMaps.put(ArtifactUtils.key(project.getGroupId(), project.getArtifactId(), project.getVersion()), project); newSession.setProjectMap(projectMaps); /** * Fake implementation of the project dependency graph, as we don't support reactor. */ ProjectDependencyGraph graph = new ProjectDependencyGraph() { @Override public List<MavenProject> getSortedProjects() { return ImmutableList.of(project); } @Override public List<MavenProject> getDownstreamProjects(MavenProject project, boolean transitive) { return Collections.emptyList(); } @Override public List<MavenProject> getUpstreamProjects(MavenProject project, boolean transitive) { return Collections.emptyList(); } }; newSession.setProjectDependencyGraph(graph); newSession.setProjects(ImmutableList.of(project)); return newSession; }
From source file:org.wisdom.maven.utils.DefaultMaven2OsgiConverter.java
License:Apache License
/** * Computes the file name of the bundle used in Wisdom distribution for the given Maven project. * This convention is based on the uniqueness at runtime of 'bsn-version' (bsn is the bundle symbolic name). * * @param project the project//from w ww. j av a 2s . c o m * @return the computed name, composed by the symbolic name and the version: {@code bsn-version.jar} */ public static String getBundleFileName(MavenProject project) { return getBundleFileName(project.getGroupId(), project.getArtifactId(), project.getVersion()); }
From source file:org.wisdom.maven.utils.MavenUtils.java
License:Apache License
/** * Gets the default set of properties for the given project. * * @param currentProject the project// w w w .j av a 2s. c o m * @return the set of properties, containing default bundle packaging instructions. */ public static Properties getDefaultProperties(MavenProject currentProject) { Properties properties = new Properties(); String bsn = DefaultMaven2OsgiConverter.getBundleSymbolicName(currentProject.getArtifact()); // Setup defaults properties.put(MAVEN_SYMBOLICNAME, bsn); properties.put("bundle.file.name", DefaultMaven2OsgiConverter.getBundleFileName(currentProject.getArtifact())); properties.put(Analyzer.BUNDLE_SYMBOLICNAME, bsn); properties.put(Analyzer.IMPORT_PACKAGE, "*"); properties.put(Analyzer.BUNDLE_VERSION, DefaultMaven2OsgiConverter.getVersion(currentProject.getVersion())); header(properties, Analyzer.BUNDLE_DESCRIPTION, currentProject.getDescription()); StringBuilder licenseText = printLicenses(currentProject.getLicenses()); if (licenseText != null) { header(properties, Analyzer.BUNDLE_LICENSE, licenseText); } header(properties, Analyzer.BUNDLE_NAME, currentProject.getName()); if (currentProject.getOrganization() != null) { if (currentProject.getOrganization().getName() != null) { String organizationName = currentProject.getOrganization().getName(); header(properties, Analyzer.BUNDLE_VENDOR, organizationName); properties.put("project.organization.name", organizationName); properties.put("pom.organization.name", organizationName); } if (currentProject.getOrganization().getUrl() != null) { String organizationUrl = currentProject.getOrganization().getUrl(); header(properties, Analyzer.BUNDLE_DOCURL, organizationUrl); properties.put("project.organization.url", organizationUrl); properties.put("pom.organization.url", organizationUrl); } } properties.putAll(currentProject.getModel().getProperties()); for (String s : currentProject.getFilters()) { File filterFile = new File(s); if (filterFile.isFile()) { properties.putAll(PropertyUtils.loadProperties(filterFile)); } } properties.putAll(getProperties(currentProject.getModel(), "project.build.")); properties.putAll(getProperties(currentProject.getModel(), "pom.")); properties.putAll(getProperties(currentProject.getModel(), "project.")); properties.put("project.baseDir", currentProject.getBasedir().getAbsolutePath()); properties.put("project.build.directory", currentProject.getBuild().getDirectory()); properties.put("project.build.outputdirectory", currentProject.getBuild().getOutputDirectory()); properties.put("project.source.roots", getArray(currentProject.getCompileSourceRoots())); properties.put("project.testSource.roots", getArray(currentProject.getTestCompileSourceRoots())); properties.put("project.resources", toString(currentProject.getResources())); properties.put("project.testResources", toString(currentProject.getTestResources())); return properties; }
From source file:org.wso2.developerstudio.appfactory.ui.actions.DeployAction.java
License:Open Source License
public void run(IAction action) { if (selection != null) { try {/*from www .ja va2 s.c o m*/ /* IViewPart findView = PlatformUI.getWorkbench().getActiveWorkbenchWindow(). getActivePage().findView("org.wso2.developerstudio.appfactory.ui.views.AppfactoryApplicationListView"); AppfactoryApplicationListView applist = (AppfactoryApplicationListView) findView;*/ IProject project = (IProject) selection.getFirstElement(); File pomfile = project.getFile("pom.xml").getLocation().toFile(); MavenProject mavenProject = MavenUtils.getMavenProject(pomfile); final Map<String, String> params = new HashMap<String, String>(); params.put("action", JagApiProperties.App_BUILD_ACTION); params.put("stage", "Development"); params.put("applicationKey", mavenProject.getArtifactId()); String version = mavenProject.getVersion(); if ("SNAPSHOT".equals(version)) { version = "trunk"; } params.put("version", version); params.put("doDeploy", "true"); Display.getCurrent().asyncExec(new Runnable() { @Override public void run() { try { HttpsJaggeryClient.httpPost(JagApiProperties.getBuildApplication(), params); } catch (Exception e) { log.error("Remote method invocation Error !", e); } } }); } catch (Exception e) { log.error("Project Pom Error !", e); } } }