List of usage examples for org.apache.maven.project MavenProject getBasedir
public File getBasedir()
From source file:com.github.zhve.ideaplugin.IdeaCleanMojo.java
License:Apache License
@Override public void execute() throws MojoExecutionException, MojoFailureException { getLog().info("Delete Workspace Files:"); for (MavenProject project : reactorProjects) { Util.deleteFileOrDirectory(getLog(), new File(project.getBasedir(), project.getArtifactId() + ".iml")); if (project.isExecutionRoot()) { Util.deleteFileOrDirectory(getLog(), new File(project.getBasedir(), ".idea")); Util.deleteFileOrDirectory(getLog(), new File(project.getBasedir(), project.getArtifactId() + ".ipr")); Util.deleteFileOrDirectory(getLog(), new File(project.getBasedir(), project.getArtifactId() + ".iws")); }//from www .j a va 2 s .com } }
From source file:com.github.zhve.ideaplugin.IdeaPluginMojo.java
License:Apache License
protected void doExecute() throws Exception { // prepare/*from w w w. j a v a 2s .c o m*/ ArtifactHolder artifactHolder = getArtifactHolder(); VelocityWorker velocityWorker = getVelocityWorker(); VelocityContext context = new VelocityContext(); MavenProject project = getProject(); // fill iml-attributes String buildDirectory = project.getBuild().getDirectory(); String standardBuildDirectory = project.getFile().getParent() + File.separator + "target"; context.put("buildDirectory", buildDirectory.startsWith(standardBuildDirectory) ? standardBuildDirectory : buildDirectory); context.put("context", this); context.put("gaeHome", gaeHome == null ? null : new File(gaeHome).getCanonicalPath()); context.put("MD", "$MODULE_DIR$"); context.put("packagingPom", "pom".equals(project.getPackaging())); context.put("packagingWar", "war".equals(project.getPackaging())); context.put("project", project); // generate iml file createFile(context, velocityWorker.getImlTemplate(), "iml"); // for non execution root just exit if (!getProject().isExecutionRoot()) return; // fill ipr-attributes context.put("M", getLocalRepositoryBasePath()); context.put("assembleModulesIntoJars", assembleModulesIntoJars); context.put("jdkName", jdkName); context.put("jdkLevel", jdkLevel); context.put("wildcardResourcePatterns", Util.escapeXmlAttribute(wildcardResourcePatterns)); List<MavenProject> warProjects = artifactHolder.getProjectsWithPackaging("war"); // check id uniques Set<String> used = new HashSet<String>(); for (MavenProject item : warProjects) if (!used.add(item.getArtifactId())) throw new MojoExecutionException( "Two or more war-packagins projects in reactor have the same artifactId, please make sure that <artifactId> is unique for each war-packagins project."); Collections.sort(warProjects, ProjectComparator.INSTANCE); context.put("warProjects", warProjects); IssueManagement issueManagement = getProject().getIssueManagement(); if (issueManagement != null) { String system = issueManagement.getSystem(); String url = issueManagement.getUrl(); if ("Redmine".equalsIgnoreCase(system)) { context.put("issueNavigationExist", Boolean.TRUE); context.put("issueRegexp", "\\d+"); context.put("linkRegexp", url + "/issues/$0"); } else if ("JIRA".equalsIgnoreCase(system)) { context.put("issueNavigationExist", Boolean.TRUE); context.put("issueRegexp", "[A-Z]+\\-\\d+"); context.put("linkRegexp", url + "/browse/$0"); } else if ("YouTrack".equalsIgnoreCase(system)) { context.put("issueNavigationExist", Boolean.TRUE); context.put("issueRegexp", "[A-Z]+\\-\\d+"); context.put("linkRegexp", url + "/issue/$0"); } else if ("Google Code".equalsIgnoreCase(system)) { context.put("issueNavigationExist", Boolean.TRUE); context.put("issueRegexp", "\\d+"); context.put("linkRegexp", url + "/issues/detail?id=$0"); } else if ("GitHub".equalsIgnoreCase(system)) { context.put("issueNavigationExist", Boolean.TRUE); context.put("issueRegexp", "\\d+"); context.put("linkRegexp", url + "/$0"); } } createFile(context, velocityWorker.getIprTemplate(), "ipr"); // fill iws-attributes context.put("compileInBackground", compileInBackground); context.put("assertNotNull", assertNotNull); context.put("hideEmptyPackages", hideEmptyPackages); context.put("autoscrollToSource", autoscrollToSource); context.put("autoscrollFromSource", autoscrollFromSource); context.put("sortByType", sortByType); context.put("optimizeImportsBeforeCommit", optimizeImportsBeforeCommit); context.put("reformatCodeBeforeCommit", reformatCodeBeforeCommit); context.put("performCodeAnalysisBeforeCommit", performCodeAnalysisBeforeCommit); if (!warProjects.isEmpty()) { // fill war-attributes MavenProject warProject = getDefaultWarProject(warProjects); context.put("warProject", warProject); warProjects.remove(warProject); context.put("otherWarProjects", warProjects); context.put("applicationServerTitle", StringUtils.isEmpty(applicationServerTitle) ? warProject.getArtifactId() : Util.escapeXmlAttribute(applicationServerTitle)); context.put("applicationServerName", gaeHome == null ? applicationServerName : "Google AppEngine Dev"); context.put("applicationServerVersion", applicationServerVersion); context.put("openInBrowser", openInBrowser); context.put("openInBrowserUrl", Util.escapeXmlAttribute(openInBrowserUrl)); context.put("vmParameters", vmParameters == null ? "" : Util.escapeXmlAttribute(vmParameters)); context.put("deploymentContextPath", deploymentContextPath); if (gaeHome != null) { context.put("applicationServerConfigurationType", "GoogleAppEngineDevServer"); context.put("applicationServerFullName", applicationServerFullName == null ? "AppEngine Dev" : applicationServerFullName); } else if ("Tomcat".equals(applicationServerName)) { context.put("applicationServerConfigurationType", "#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory"); context.put("applicationServerFullName", applicationServerFullName == null ? applicationServerName + " " + applicationServerVersion : applicationServerFullName); } else if ("Jetty".equals(applicationServerName)) { context.put("applicationServerConfigurationType", "org.codebrewer.idea.jetty.JettyRunConfigurationType"); context.put("applicationServerFullName", applicationServerFullName == null ? applicationServerName + " " + applicationServerVersion : applicationServerFullName); } else throw new MojoExecutionException("Unknown applicationServerName: " + applicationServerName + ", possible values: Tomcat, Jetty"); } createFile(context, velocityWorker.getIwsTemplate(), "iws"); File idea = new File(project.getBasedir(), ".idea"); if (idea.exists()) { getLog().info(""); getLog().info("Delete Workspace Files:"); getLog().info(""); Util.deleteFileOrDirectory(getLog(), idea); } }
From source file:com.google.code.play.PlayDependenciesMojo.java
License:Apache License
protected void internalExecute() throws MojoExecutionException, MojoFailureException, IOException { if (dependenciesSkip) { getLog().info("Dependencies extraction skipped"); return;//ww w . jav a 2s. co m } File baseDir = project.getBasedir(); try { if (dependenciesClean) { if (!dependenciesSkipJars) { FileUtils.deleteDirectory(new File(baseDir, "lib")); } FileUtils.deleteDirectory(new File(baseDir, "modules")); } Set<?> projectArtifacts = project.getArtifacts(); Set<Artifact> excludedArtifacts = new HashSet<Artifact>(); Artifact playSeleniumJunit4Artifact = getDependencyArtifact(projectArtifacts, "com.google.code.maven-play-plugin", "play-selenium-junit4", "jar"); if (playSeleniumJunit4Artifact != null) { excludedArtifacts.addAll(getDependencyArtifacts(projectArtifacts, playSeleniumJunit4Artifact)); } Set<Artifact> filteredArtifacts = new HashSet<Artifact>(); // TODO-rename to filteredClassPathArtifacts for (Iterator<?> iter = projectArtifacts.iterator(); iter.hasNext();) { Artifact artifact = (Artifact) iter.next(); if (artifact.getArtifactHandler().isAddedToClasspath() && !Artifact.SCOPE_PROVIDED.equals(artifact.getScope()) && !excludedArtifacts.contains(artifact)) { // TODO-add checkPotentialReactorProblem( artifact ); filteredArtifacts.add(artifact); } } // modules/*/lib File modulesDir = new File(baseDir, "modules"); Map<String, Artifact> moduleArtifacts = findAllModuleArtifacts(true); for (Map.Entry<String, Artifact> moduleArtifactEntry : moduleArtifacts.entrySet()) { String moduleName = moduleArtifactEntry.getKey(); Artifact moduleZipArtifact = moduleArtifactEntry.getValue(); if (!Artifact.SCOPE_PROVIDED.equals(moduleZipArtifact.getScope())) { boolean foundInReactor = false; for (MavenProject reactorProject : reactorProjects) { if (reactorProject != project) { Artifact reactorProjectArtifact = reactorProject.getArtifact(); if (reactorProjectArtifact.getGroupId().equals(moduleZipArtifact.getGroupId()) && reactorProjectArtifact.getArtifactId() .equals(moduleZipArtifact.getArtifactId()) && reactorProjectArtifact.getVersion().equals(moduleZipArtifact.getVersion())) { File reactorProjectBasedir = reactorProject.getBasedir(); String relativePath = PathTool.getRelativeFilePath(baseDir.getAbsolutePath(), reactorProjectBasedir.getAbsolutePath()); File moduleLinkFile = new File(modulesDir, String.format("%s-%s", reactorProject.getArtifact().getArtifactId(), reactorProject.getArtifact().getVersion())); if (moduleLinkFile.isDirectory()) { getLog().info(String.format("Deleting \"%s\" directory", moduleLinkFile)); // TODO-more descriptive message FileUtils.deleteDirectory(moduleLinkFile); } else if (!moduleLinkFile.getParentFile().exists()) { if (!moduleLinkFile.getParentFile().mkdirs()) { throw new IOException(String.format("Cannot create \"%s\" directory", moduleLinkFile.getParentFile().getCanonicalPath())); } } if (dependenciesForceCopy) { org.apache.commons.io.FileUtils.copyDirectory(reactorProjectBasedir, moduleLinkFile); } else { writeToFile(moduleLinkFile, relativePath); } buildContext.refresh(moduleLinkFile); foundInReactor = true; getLog().info(String.format( "Play! module dependency found in reactor, relative path is \"%s\"", relativePath)); break; } } } if (foundInReactor) { continue; } //already not needed checkPotentialReactorProblem( moduleZipArtifact ); File moduleZipFile = moduleZipArtifact.getFile(); String moduleSubDir = String.format("%s-%s", moduleName, moduleZipArtifact.getBaseVersion()); File moduleDirectory = new File(modulesDir, moduleSubDir); createModuleDirectory(moduleDirectory, dependenciesOverwrite || moduleDirectory.lastModified() < moduleZipFile.lastModified()); if (moduleDirectory.list().length == 0) { UnArchiver zipUnArchiver = archiverManager.getUnArchiver("zip"); zipUnArchiver.setSourceFile(moduleZipFile); zipUnArchiver.setDestDirectory(moduleDirectory); zipUnArchiver.setOverwrite(false/* ??true */ ); zipUnArchiver.extract(); moduleDirectory.setLastModified(System.currentTimeMillis()); buildContext.refresh(moduleDirectory); // Scala module hack if ("scala".equals(moduleName)) { scalaHack(moduleDirectory, filteredArtifacts); } if (!dependenciesSkipJars) { Set<Artifact> dependencySubtree = getModuleDependencyArtifacts(filteredArtifacts, moduleZipArtifact); if (!dependencySubtree.isEmpty()) { File moduleLibDir = new File(moduleDirectory, "lib"); createLibDirectory(moduleLibDir); for (Artifact classPathArtifact : dependencySubtree) { File jarFile = classPathArtifact.getFile(); if (dependenciesOverwrite) { FileUtils.copyFileToDirectory(jarFile, moduleLibDir); } else { if (jarFile == null) { getLog().info("null file"); // TODO-??? } FileUtils.copyFileToDirectoryIfModified(jarFile, moduleLibDir); } filteredArtifacts.remove(classPathArtifact); } } } } else // just remove dependency tree from "filteredArtifacts" collection { if (!dependenciesSkipJars) { Set<Artifact> dependencySubtree = getModuleDependencyArtifacts(filteredArtifacts, moduleZipArtifact); for (Artifact classPathArtifact : dependencySubtree) { filteredArtifacts.remove(classPathArtifact); } } } } } // lib if (!dependenciesSkipJars && !filteredArtifacts.isEmpty()) { File libDir = new File(baseDir, "lib"); createLibDirectory(libDir); for (Iterator<?> iter = filteredArtifacts.iterator(); iter.hasNext();) { Artifact classPathArtifact = (Artifact) iter.next(); File jarFile = classPathArtifact.getFile(); // In a reactor (multi-module) build if "play" module depends on "jar" module, // "jar" module artifact's file can be a directory instead of a file. // This happens when "compile" lifecycle phase or any phase between "compile" // and "package" has ben executed before "play:dependencies" mojo // (for example "mvn compile play:dependencies"). // How to solve this problem? // Dependency "jar" artifact has to be installed first ("mvn install" for "jar" // module only) or at least "package" phase has to be executed for the whole reactor // before "play:dependencies" ("mvn package play:dependencies"). checkPotentialReactorProblem(classPathArtifact); if (dependenciesOverwrite) { FileUtils.copyFileToDirectory(jarFile, libDir); buildContext.refresh(new File(libDir, jarFile.getName())); } else { if (FileUtils.copyFileIfModified(jarFile, new File(libDir, jarFile.getName()))) { buildContext.refresh(new File(libDir, jarFile.getName())); } } } } } catch (ArchiverException e) { // throw new MojoExecutionException( "Error unpacking file [" + file.getAbsolutePath() + "]" + "to [" // + unpackDirectory.getAbsolutePath() + "]", e ); throw new MojoExecutionException("?", e); } catch (DependencyTreeBuilderException e) { throw new MojoExecutionException("?", e); } catch (NoSuchArchiverException e) { throw new MojoExecutionException("?", e); } }
From source file:com.google.gdt.eclipse.maven.configurators.MavenProjectConfigurator.java
License:Open Source License
/** * Returns the war source directory such as src/main/webapp * * @param mavenProject/*from w w w . j a v a 2s. co m*/ * * @param config * gwt-maven-maven config DOM * @return the {@link #WAR_SRC_DIR_PROPERTY_KEY} value from the config if it exists, {@link #WAR_SRC_DIR_DEFAULT} * otherwise or if config is null */ private static final IPath getWarSrcDir(MavenProject mavenProject, Xpp3Dom config) { String spath = WAR_SRC_DIR_DEFAULT; if (config != null) { for (Xpp3Dom child : config.getChildren()) { if (child != null && WAR_SRC_DIR_PROPERTY_KEY.equals(child.getName())) { spath = child.getValue() == null ? WAR_SRC_DIR_DEFAULT : child.getValue().trim(); } } } IPath path = null; if (spath != null) { path = new Path(spath); String basePath = mavenProject.getBasedir().toPath().toAbsolutePath().toString(); String fullPath = basePath + "/" + spath; java.io.File fullPathFile = new java.io.File(fullPath); if (!fullPathFile.exists()) { path = null; } } return path; }
From source file:com.google.gdt.eclipse.maven.e35.configurators.GoogleProjectConfigurator.java
License:Open Source License
@Override protected void doConfigure(final MavenProject mavenProject, IProject project, ProjectConfigurationRequest request, final IProgressMonitor monitor) throws CoreException { final IMaven maven = MavenPlugin.getDefault().getMaven(); boolean configureGaeNatureSuccess = configureNature(project, mavenProject, GaeNature.NATURE_ID, true, new NatureCallbackAdapter() { @Override/*from w w w . j a v a2 s. co m*/ public void beforeAddingNature() { try { DefaultMavenExecutionRequest executionRequest = new DefaultMavenExecutionRequest(); executionRequest.setBaseDirectory(mavenProject.getBasedir()); executionRequest.setLocalRepository(maven.getLocalRepository()); executionRequest.setRemoteRepositories(mavenProject.getRemoteArtifactRepositories()); executionRequest .setPluginArtifactRepositories(mavenProject.getPluginArtifactRepositories()); executionRequest.setPom(mavenProject.getFile()); executionRequest.setGoals(GAE_UNPACK_GOAL); MavenExecutionResult result = maven.execute(executionRequest, monitor); if (result.hasExceptions()) { Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error configuring project", result.getExceptions().get(0))); } } catch (CoreException e) { Activator.getDefault().getLog().log( new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error configuring project", e)); } } }, monitor); boolean configureGWTNatureSuccess = configureNature(project, mavenProject, GWTNature.NATURE_ID, true, new NatureCallbackAdapter() { @Override public void beforeAddingNature() { // Get the GWT version from the project pom String gwtVersion = null; List<Dependency> dependencies = mavenProject.getDependencies(); for (Dependency dependency : dependencies) { if (GWTMavenRuntime.MAVEN_GWT_GROUP_ID.equals(dependency.getGroupId()) && (GWTMavenRuntime.MAVEN_GWT_USER_ARTIFACT_ID .equals(dependency.getArtifactId()) || GWTMavenRuntime.MAVEN_GWT_SERVLET_ARTIFACT_ID .equals(dependency.getArtifactId()))) { gwtVersion = dependency.getVersion(); break; } } // Check that the pom.xml has GWT dependencies if (!StringUtilities.isEmpty(gwtVersion)) { try { /* * Download and install the gwt-dev.jar into the local * repository. */ maven.resolve(GWTMavenRuntime.MAVEN_GWT_GROUP_ID, GWTMavenRuntime.MAVEN_GWT_DEV_JAR_ARTIFACT_ID, gwtVersion, "jar", null, mavenProject.getRemoteArtifactRepositories(), monitor); } catch (CoreException e) { Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error configuring project", e)); } } } }, monitor); if (configureGWTNatureSuccess || configureGaeNatureSuccess) { try { // Add GWT Web Application configuration parameters WebAppProjectProperties.setWarSrcDir(project, new Path("src/main/webapp")); WebAppProjectProperties.setWarSrcDirIsOutput(project, false); String artifactId = mavenProject.getArtifactId(); String version = mavenProject.getVersion(); IPath location = (project.getRawLocation() != null ? project.getRawLocation() : project.getLocation()); if (location != null && artifactId != null && version != null) { WebAppProjectProperties.setLastUsedWarOutLocation(project, location.append("target").append(artifactId + "-" + version)); } } catch (BackingStoreException be) { Activator.getDefault().getLog() .log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error configuring project", be)); } } }
From source file:com.googlecode.jsfFlexPlugIn.mojo.CreateSwcConfigurationFile.java
License:Apache License
public void inspectionCompleted() { final String SWC_CONFIG_FILE_CLASS_DIRECTORY = "target" + File.separatorChar + "classes" + File.separatorChar + "com" + File.separatorChar + "googlecode" + File.separatorChar + "jsfFlex" + File.separatorChar + "shared" + File.separatorChar + "tasks" + File.separatorChar; final String ANT_FLEX_TASK_RUNNER_IMPL = File.separatorChar + "runnerImpl" + File.separatorChar + "flexTaskRunnerImpl" + File.separatorChar + "antFlexTaskRunnerImpl" + File.separatorChar + SWC_CONFIG_FILE_CLASS_DIRECTORY; final String JYTHON_FLEX_TASK_RUNNER_IMPL = File.separatorChar + "runnerImpl" + File.separatorChar + "flexTaskRunnerImpl" + File.separatorChar + "jythonFlexTaskRunnerImpl" + File.separatorChar + SWC_CONFIG_FILE_CLASS_DIRECTORY; final String FLEX_CONSTANTS_XML_TEMPLATE_FILE_NAME = "jsf-flex-flexConstants.vm"; final String JSF_FLEX_MAIN_SWC_CONFIGURATION_FILE_XML_TEMPLATE_FILE_NAME = "jsf-flex-jsfFlexMainSwcConfigurationFile.vm"; final String FLEX_CONSTANTS_XML_FILE_NAME = "flexConstants.xml"; final String JSF_FLEX_MAIN_SWC_CONFIGURATION_FILE_XML_FILE_NAME = "jsfFlexMainSwcConfigurationFile.xml"; MavenProject topProject = _project.getParent().getParent(); String basePath = topProject.getBasedir().getAbsolutePath(); String antFlexTaskRunnerSwcConfigFilePath = basePath + ANT_FLEX_TASK_RUNNER_IMPL; String jythonFlexTaskRunnerSwcConfigFilePath = basePath + JYTHON_FLEX_TASK_RUNNER_IMPL; String flexConstantFilePath = _toCreateFlexConstantsXMLPath.getPath(); ExecutorService mergeCollectionTemplatePool = Executors.newFixedThreadPool(3); try {//from ww w . j a va2 s . com Properties velocityParserProperties = new Properties(); velocityParserProperties.put(FILE_RESOURCE_LOADER_PATH_KEY, _templateSourceDirectory.getPath()); submitMergeContent(mergeCollectionTemplatePool, flexConstantFilePath, FLEX_CONSTANTS_XML_FILE_NAME, velocityParserProperties, FLEX_CONSTANTS_XML_TEMPLATE_FILE_NAME); submitMergeContent(mergeCollectionTemplatePool, antFlexTaskRunnerSwcConfigFilePath, JSF_FLEX_MAIN_SWC_CONFIGURATION_FILE_XML_FILE_NAME, velocityParserProperties, JSF_FLEX_MAIN_SWC_CONFIGURATION_FILE_XML_TEMPLATE_FILE_NAME); submitMergeContent(mergeCollectionTemplatePool, jythonFlexTaskRunnerSwcConfigFilePath, JSF_FLEX_MAIN_SWC_CONFIGURATION_FILE_XML_FILE_NAME, velocityParserProperties, JSF_FLEX_MAIN_SWC_CONFIGURATION_FILE_XML_TEMPLATE_FILE_NAME); try { _mergeCollectionTemplateLatch.await(); } catch (InterruptedException interruptedExcept) { Thread.currentThread().interrupt(); } } finally { if (mergeCollectionTemplatePool != null) { mergeCollectionTemplatePool.shutdownNow(); } } }
From source file:com.jayway.maven.plugins.android.common.BuildHelper.java
License:Open Source License
public BuildHelper(RepositorySystem repoSystem, RepositorySystemSession repoSession, MavenProject project, Logger log) {/*from w w w . jav a 2 s . com*/ this.repoSystem = repoSystem; this.repoSession = repoSession; this.projectRepos = project.getRemoteProjectRepositories(); final File targetFolder = new File(project.getBasedir(), "target"); this.unpackedLibsDirectory = new File(targetFolder, "unpacked-libs"); this.log = log; }
From source file:com.jayway.maven.plugins.android.common.UnpackedLibHelper.java
License:Open Source License
public UnpackedLibHelper(ArtifactResolverHelper artifactResolverHelper, MavenProject project, Logger log) { this.artifactResolverHelper = artifactResolverHelper; final File targetFolder = new File(project.getBasedir(), "target"); this.unpackedLibsDirectory = new File(targetFolder, "unpacked-libs"); this.log = log; }
From source file:com.liferay.ide.maven.core.MavenBundlePluginProject.java
License:Open Source License
@Override public IPath getOutputBundle(boolean cleanBuild, IProgressMonitor monitor) throws CoreException { IPath outputJar = null;/* w w w . jav a2 s. c o m*/ final IMavenProjectFacade projectFacade = MavenUtil.getProjectFacade(getProject(), monitor); final MavenProjectBuilder mavenProjectBuilder = new MavenProjectBuilder(this.getProject()); // IDE-3009 delete the MANIFEST.MF to ensure that it will be regenerated by bnd-process IFile manifest = this.getProject().getFile("target/classes/META-INF/MANIFEST.MF"); if (manifest.exists()) { manifest.delete(true, monitor); } if (cleanBuild || !isAutoBuild()) { this.getProject().build(IncrementalProjectBuilder.CLEAN_BUILD, monitor); this.getProject().build(IncrementalProjectBuilder.FULL_BUILD, monitor); } mavenProjectBuilder.execJarMojo(projectFacade, monitor); final MavenProject mavenProject = projectFacade.getMavenProject(monitor); final String targetName = mavenProject.getBuild().getFinalName() + ".jar"; final String buildDirectory = mavenProject.getBuild().getDirectory(); final File baseDirectory = mavenProject.getBasedir(); final IPath buildDirPath = new Path(buildDirectory); final IPath baseDirPath = new Path(baseDirectory.toString()); final IPath relativePath = buildDirPath.makeRelativeTo(baseDirPath); final IFolder targetFolder = getTargetFolder(getProject(), relativePath); if (targetFolder.exists()) { // targetFolder.refreshLocal( IResource.DEPTH_ONE, monitor ); final IPath targetFile = targetFolder.getRawLocation().append(targetName); if (targetFile.toFile().exists()) { outputJar = targetFile; } } return outputJar; }
From source file:com.marvinformatics.flex.flashbuilder.FlashbuilderMojo.java
License:Apache License
private List<Dependency> dependencies() { return transform(newArrayList(filter(project.getArtifacts(), new Predicate<Artifact>() { @Override/* w w w.j a va 2 s .c o m*/ public boolean apply(Artifact input) { return input.getType().equals("swc") && !input.getGroupId().contains("org.apache.flex"); } })), new Function<Artifact, Dependency>() { @Override public Dependency apply(Artifact artifact) { if (isReactorArtifact(artifact)) { MavenProject localProject = getReactorArtifact(artifact); return new Dependency( path(new File(localProject.getBasedir(), "bin/" + artifact.getArtifactId() + ".swc"))); } return new Dependency(path(artifact.getFile())); } }); }