basedir = session.getExecutionRootDirectory();
+ " but there is no POM in this directory (" + session.getExecutionRootDirectory() + ")." + " Please verify you invoked Maven from the correct directory." );
+ session.getExecutionRootDirectory() + ")." + " Please verify you invoked Maven from the correct directory." ); throw new LifecycleExecutionException( mojoExecution, null, cause );
if (!session.getExecutionRootDirectory().equals(session.getCurrentProject().getBasedir().getAbsolutePath())) { log.info("runOnlyOnce is enabled and this project is not the top level project, skipping execution!"); return;
private File getReleasePropertiesFile() { return new File(mavenSession.getExecutionRootDirectory(), "release.properties"); }
protected boolean isThisRootDir() { return mavenSession.getExecutionRootDirectory().equalsIgnoreCase(basedir.toString()); } }
private File getChangesFile() throws MojoExecutionException { File targetDir = new File(mavenSession.getExecutionRootDirectory(), "target"); if (!targetDir.exists() && !targetDir.mkdirs()) { throw new MojoExecutionException("Failed to create the target directory: " + targetDir); } File updateVersionsDir = new File(targetDir, "revapi-update-versions"); if (!updateVersionsDir.exists() && !updateVersionsDir.mkdirs()) { throw new MojoExecutionException("Failed to create the revapi-update-versions directory: " + targetDir); } return new File(updateVersionsDir, "per-project.changes"); }
/** * Resolves the base directory for the current execution. */ private File resolveBasedir() throws IOException { String path = null; if (project != null) { File file = project.getBasedir(); if (file != null) { path = file.getAbsolutePath(); } } if (path == null) { path = session.getExecutionRootDirectory(); } if (path == null) { path = System.getProperty("user.dir"); } return new File(path).getCanonicalFile(); }
/** * Returns true if the current project is located at the Execution Root Directory (where mvn was launched) * * @return if this is the execution root */ boolean isThisTheExecutionRoot() { final Log log = getLog(); log.debug( "Root Folder:" + mavenSession.getExecutionRootDirectory() ); log.debug( "Current Folder:" + basedir ); final boolean result = mavenSession.getExecutionRootDirectory().equalsIgnoreCase( basedir.toString() ); if ( result ) { log.debug( "This is the execution root." ); } else { log.debug( "This is NOT the execution root." ); } return result; }
/** * Returns the working directory root (the one containing all the staged and deferred deploys), that is either set * explicitly by user in plugin configuration (see {@link #altStagingDirectory} parameter), or it's location is * calculated taking as base the first project in this reactor that will/was executing this plugin. */ protected File getWorkDirectoryRoot() { if (altStagingDirectory != null) { return altStagingDirectory; } else { final MavenProject firstWithThisMojo = getFirstProjectWithThisPluginDefined(); if (firstWithThisMojo != null) { final File firstWithThisMojoBuildDir; if (firstWithThisMojo.getBuild() != null && firstWithThisMojo.getBuild().getDirectory() != null) { firstWithThisMojoBuildDir = new File(firstWithThisMojo.getBuild().getDirectory()).getAbsoluteFile(); } else { firstWithThisMojoBuildDir = new File(firstWithThisMojo.getBasedir().getAbsoluteFile(), "target"); } return new File(firstWithThisMojoBuildDir, "nexus-staging"); } else { // top level (invocation place with some sensible defaults) // TODO: what can we do here? Do we have MavenProject at all? return new File(getMavenSession().getExecutionRootDirectory() + "/target/nexus-staging"); } } }
@Override public void execute() throws MojoExecutionException, MojoFailureException { // // Fetch the latest wrapper archive // Unpack it in the current working project // Possibly interpolate the latest version of Maven in the wrapper properties // File localRepository = new File(System.getProperty("user.home"), ".m2/repository"); String artifactPath = String.format("io/takari/maven-wrapper/%s/maven-wrapper-%s.tar.gz", version, version); String wrapperUrl = String.format("https://repo1.maven.org/maven2/%s", artifactPath); File destination = new File(localRepository, artifactPath); Downloader downloader = new DefaultDownloader("mvnw", version); try { downloader.download(new URI(wrapperUrl), destination); UnArchiver unarchiver = UnArchiver.builder().useRoot(false).build(); Path rootDirectory = Paths.get(session.getExecutionRootDirectory()); unarchiver.unarchive(destination, rootDirectory.toFile()); overwriteDistributionUrl(rootDirectory, getDistributionUrl()); getLog().info(""); getLog().info("The Maven Wrapper version " + version + " has been successfully setup for your project."); getLog().info("Using Apache Maven " + maven); getLog().info(""); } catch (Exception e) { throw new MojoExecutionException("Error installing the maven-wrapper archive.", e); } }
final File syncInfoFile = new File(mavenSession.getExecutionRootDirectory(), syncInfo);
getLog().info("Execution root dir: " + this.session.getExecutionRootDirectory());
,reactorManager ,oldSession.getGoals() ,oldSession.getExecutionRootDirectory() ,oldSession.getExecutionProperties() ,oldSession.getUserProperties()
getLog().info("Execution root dir: " + this.session.getExecutionRootDirectory());
result.file(), String.format( "%s/", this.session().getExecutionRootDirectory()
String sourceFolder = mavenSession.getExecutionRootDirectory(); if (sourceFolder != null) {
if (!session.getExecutionRootDirectory().equals(session.getCurrentProject().getBasedir().getAbsolutePath())) { log.info("runOnlyOnce is enabled and this project is not the top level project, skipping execution!"); return;