initCertStore(); Properties props = new Properties(); try { File extractedConfigPropFile = new File( getExtractedRunnerPath(), PROJECT_FILE ); FileInputStream inputStream = new FileInputStream( extractedConfigPropFile ); props.load( inputStream ); inputStream.close(); throw new MojoExecutionException( e.getMessage() ); WebResource resource = client.resource( endpoint ).path( "/status" ); LOG.info( "Commit ID: {}", props.getProperty( Project.GIT_UUID_KEY ) ); LOG.info( "Artifact Id: {}", props.getProperty( Project.ARTIFACT_ID_KEY ) ); LOG.info( "Group Id: {}", props.getProperty( Project.GROUP_ID_KEY ) ); LOG.error( "Error Message: {}", resp.getEntity( String.class ) ); throw new MojoExecutionException( "Status plugin goal has failed" );
/** * Generates the Dependency-Check Site Report. * * @param sink the sink to write the report to * @param locale the locale to use when generating the report * @throws MavenReportException if a maven report exception occurs */ public void generate(Sink sink, Locale locale) throws MavenReportException { final boolean shouldSkip = Boolean.parseBoolean(System.getProperty("dependency-check.skip", Boolean.toString(skip))); if (shouldSkip) { getLog().info("Skipping report generation " + getName(Locale.US)); return; } generatingSite = true; try { validateAggregate(); } catch (MojoExecutionException ex) { throw new MavenReportException(ex.getMessage()); } project.setContextValue(getOutputDirectoryContextKey(), getReportOutputDirectory()); try { runCheck(); } catch (MojoExecutionException ex) { throw new MavenReportException(ex.getMessage(), ex); } catch (MojoFailureException ex) { getLog().warn("Vulnerabilities were identifies that exceed the CVSS threshold for failing the build"); } }
private Document build() throws MojoExecutionException getLog().debug( "load plugin-help.xml: " + PLUGIN_HELP_PATH ); InputStream is = null; try DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); return dBuilder.parse( is ); throw new MojoExecutionException( e.getMessage(), e ); throw new MojoExecutionException( e.getMessage(), e ); throw new MojoExecutionException( e.getMessage(), e ); throw new MojoExecutionException( e.getMessage(), e );
@Override public void execute() throws MojoExecutionException { final Log log = getLog(); try { if (log.isDebugEnabled()) { log.debug("classPath: " + classPath); log.debug("classPaths: " + Arrays.deepToString(classPaths)); log.debug("buildPath: " + buildPath); log.debug("buildPaths: " + Arrays.deepToString(buildPaths)); project.addCompileSourceRoot(targetDirectory); v.length() == 0 || v.endsWith(separator) ? v + s : v + separator + s); properties.setProperty("platform.artifacts", project.getBuild().getOutputDirectory()); for (Artifact a : plugin.getArtifacts()) { String s = a.getFile().getCanonicalPath(); String v = properties.getProperty("platform.artifacts", ""); properties.setProperty("platform.artifacts", v.length() == 0 || v.endsWith(separator) ? v + s : v + separator + s); Properties projectProperties = project.getProperties(); for (String key : properties.stringPropertyNames()) { projectProperties.setProperty("javacpp." + key, properties.getProperty(key)); log.error("Failed to execute JavaCPP Builder: " + e.getMessage()); throw new MojoExecutionException("Failed to execute JavaCPP Builder", e);
throw new MojoExecutionException( "Failed to generate the project.properties." ); Properties props = new Properties(); props.load( new FileInputStream( projectFile ) ); ProjectBuilder builder = new ProjectBuilder( props ); project = builder.getProject(); throw new MojoExecutionException( "Cannot access local file system based project information: " + getProjectFileToUploadPath(), e );
getLog().debug( "copyManifest: " + androidManifestFile + " -> " + destinationManifestFile ); if ( androidManifestFile == null ) getLog().debug( "Manifest copying disabled. Using default manifest only" ); return; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse( androidManifestFile ); Source source = new DOMSource( doc ); getLog().info( "Manifest copied from " + androidManifestFile + " to " + destinationManifestFile ); getLog().error( "Error during copyManifest" ); throw new MojoExecutionException( "Error during copyManifest", e );
protected void invokeInstalled(MavenSession session, List<String> goals, boolean updateSnapshots, Map<String, String> properties) throws MojoExecutionException { InvocationRequest request = new DefaultInvocationRequest(); request.setPomFile(session.getRequest().getPom()); request.setGoals(goals); request.setAlsoMake(true); request.setUpdateSnapshots(updateSnapshots); Properties props = new Properties(); props.putAll(properties); request.setProperties(props); Invoker invoker = new DefaultInvoker(); boolean success; try { InvocationResult result = invoker.execute(request); success = result.getExitCode() == 0 && result.getExecutionException() == null; } catch (MavenInvocationException e) { throw new MojoExecutionException("Invocation error! " + ABORT, e); } failIf(!success, "An error occurred. " + ABORT); }
private AuthConfig getAuthConfigFromSystemProperties(LookupMode lookupMode) throws MojoExecutionException { Properties props = System.getProperties(); String userKey = lookupMode.asSysProperty(AUTH_USERNAME); String passwordKey = lookupMode.asSysProperty(AUTH_PASSWORD); if (props.containsKey(userKey)) { if (!props.containsKey(passwordKey)) { throw new MojoExecutionException("No " + passwordKey + " provided for username " + props.getProperty(userKey)); } return new AuthConfig(props.getProperty(userKey), decrypt(props.getProperty(passwordKey)), props.getProperty(lookupMode.asSysProperty(AUTH_EMAIL)), props.getProperty(lookupMode.asSysProperty(AUTH_AUTHTOKEN))); } else { return null; } }
public void execute() throws MojoExecutionException, MojoFailureException getLog().info( "Skipping OpenAPI specification resolution" ); return; getLog().info( "Resolving OpenAPI specification.." ); String pEnc = project.getProperties().getProperty("project.build.sourceEncoding"); if (StringUtils.isNotBlank(pEnc)) { projectEncoding = pEnc; openAPIInput = Yaml.mapper().readValue(openapiFileContent, OpenAPI.class); } catch (Exception e1) { getLog().error( "Error reading/deserializing openapi file" , e); throw new MojoFailureException(e.getMessage(), e); getLog().error( "Error reading/deserializing openapi file" , e); throw new MojoFailureException(e.getMessage(), e); getLog().error( "Error resolving API specification" , e); throw new MojoFailureException(e.getMessage(), e); } catch (IOException e) { getLog().error( "Error writing API specification" , e); throw new MojoExecutionException("Failed to write API definition", e); } catch (Exception e) { getLog().error( "Error resolving API specification" , e); throw new MojoExecutionException(e.getMessage(), e);
/** * Initialize the document builder from Xerces. * * @return DocumentBuilder ready to create new document * @throws MojoExecutionException : occurs when the instantiation of the document builder fails */ private DocumentBuilder initConstructor() throws MojoExecutionException { DocumentBuilder constructor = null; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { constructor = factory.newDocumentBuilder(); } catch ( ParserConfigurationException e ) { getLog().error( "Unable to create a new xml document" ); throw new MojoExecutionException( "Cannot create the Document Builder : " + e.getMessage() ); } return constructor; }
@Override public void execute() throws MojoExecutionException { try { SCM scm = determineSCM(); project.getProperties().setProperty(buildTimeProperty, getBuildTime()); project.getProperties().setProperty(scmUriProperty, getSCMUri(scm)); project.getProperties().setProperty(scmBranchProperty, getSCMBranch(scm)); project.getProperties().setProperty(scmCommitProperty, getSCMCommit(scm)); project.getProperties().setProperty(md5Property, computeMD5()); } catch (Throwable ex) { throw new MojoExecutionException(ex.toString(), ex); } }
if ( contentGraphicList == null || contentGraphicList.isEmpty() ) getLog().warn( "There are no images in " + dir.getAbsolutePath() + "/" + imageType ); return ; try getLog().info( "Deleting the old " + imageType ); getLog().error( message ); throw new MojoFailureException( message ); getLog().error( e.getMessage(), e ); throw new MojoExecutionException( e.getMessage(), e );
@SuppressWarnings({ "unchecked" }) @Override public void execute() throws MojoExecutionException, MojoFailureException { if (!CommonUtils.initSaturnHome()) throw new MojoExecutionException("The ${user.home}/.saturn/caches is not exists"); Log log = getLog(); MavenProject project = (MavenProject) getPluginContext().get("project"); String version = getSaturnVersion(project); log.info("Packing the saturn job into a zip file: version:" + version); List<File> runtimeLibFiles = new ArrayList<File>(); List<Artifact> runtimeArtifacts = project.getRuntimeArtifacts(); for (Artifact artifact : runtimeArtifacts) { runtimeLibFiles.add(artifact.getFile()); } runtimeLibFiles.add(new File(project.getBuild().getDirectory(), project.getBuild().getFinalName() + "." + project.getPackaging())); File zipFile = new File(project.getBuild().getDirectory(), project.getArtifactId() + "-" + project.getVersion() + "-" + "app.zip"); try { CommonUtils.zip(runtimeLibFiles, null, zipFile); } catch (Exception e) { e.printStackTrace(); throw new MojoExecutionException("zip " + zipFile + " failed", e); } projectHelper.attachArtifact(project, "zip", "executor", zipFile); }
outputDir = new File(this.getProject().getBuild().getDirectory()); engine.writeReports(p.getName(), p.getGroupId(), p.getArtifactId(), p.getVersion(), outputDir, getFormat()); } catch (ReportException ex) { if (exCol == null) { throw new MojoExecutionException("One or more exceptions occurred during dependency-check analysis", exCol); } else { getLog().debug("Error writing the report", ex); checkForFailure(engine.getDependencies()); if (exCol != null && this.isFailOnError()) { throw new MojoExecutionException("One or more exceptions occurred during dependency-check analysis", exCol); if (getLog().isDebugEnabled()) { getLog().debug("Database connection error", ex); throw new MojoExecutionException(msg, ex); getLog().error(msg, ex);
@Override protected void execute(Speedment speedment) throws MojoExecutionException, MojoFailureException { getLog().info("Saving default configuration from database to '" + configLocation().toAbsolutePath() + "'."); final ConfigFileHelper helper = speedment.getOrThrow(ConfigFileHelper.class); try { helper.setCurrentlyOpenFile(configLocation().toFile()); helper.loadFromDatabaseAndSaveToFile(); } catch (final Exception ex) { final String err = "An error occured while reloading."; getLog().error(err); throw new MojoExecutionException(err, ex); } }
@Override public void execute() throws MojoExecutionException, MojoFailureException { if (mainClass == null) { throw new MojoExecutionException("main class not configured"); } try (URLClassLoader loader = new Classpath(mavenProject).toClassLoader()) { Path srcdir = new File(mavenProject.getBuild().getSourceDirectory()).toPath(); Path bindir = new File(mavenProject.getBuild().getOutputDirectory()).toPath(); getLog().debug("Using classloader " + loader); getLog().debug(" source: " + srcdir); getLog().debug(" bin: " + bindir); Path output = new ApiParser(srcdir) .with(loader) .export(bindir, mainClass); getLog().info("API file: " + output); } catch (Exception x) { throw new MojoFailureException("ApiTool resulted in exception: ", x); } } }
try { urls.add( file.toURI().toURL() ); getLog().debug( "Adding classpath entry for classes root " + file.getAbsolutePath() ); throw new MojoExecutionException( msg, e ); getLog().warn( msg ); Set<Artifact> artifacts = project.getArtifacts(); if ( artifacts != null) { for ( Artifact a : artifacts ) { if ( !Artifact.SCOPE_TEST.equals( a.getScope() ) ) { try { urls.add( a.getFile().toURI().toURL() ); getLog().debug( "Adding classpath entry for dependency " + a.getId() ); String msg = "Unable to resolve URL for dependency " + a.getId() + " at " + a.getFile().getAbsolutePath(); if ( failOnError ) { throw new MojoExecutionException( msg, e ); getLog().warn( msg );
ClassLoader projectCL = getProjectClassLoader(); if (usesDataCollectorAPI(projectCL)) { File file = new File(project.getBuild().getOutputDirectory(), BUNDLES_TO_GEN_FILE); if (file.exists() && file.isFile()) { Map<String, File> bundles = new HashMap<>(); bundles.put(bundleName, bundleFile); File jarFile = new File(project.getBuild().getDirectory(), project.getArtifactId() + "-" + project.getVersion() + "-bundles.jar"); getLog().info("Building bundles jar: " + jarFile.getAbsolutePath()); createBundlesJar(jarFile, bundles); } else { getLog().debug(BUNDLES_TO_GEN_FILE + "' file does not have any class, no bundles jar will be generated"); getLog().debug("Project does not have '" + BUNDLES_TO_GEN_FILE + "' file, no bundles jar will be generated"); throw new MojoExecutionException(ex.toString(), ex);
private void generateR() throws MojoExecutionException getLog().info( "Generating R file for " + project.getArtifact() ); .makeResourcesNonConstant( AAR.equals( project.getArtifact().getType() ) ) .addExtraArguments( aaptExtraArgs ); getLog().debug( getAndroidSdk().getAaptPath() + " " + commandBuilder.toString() ); try executor.setCaptureStdOut( true ); final List<String> commands = commandBuilder.build(); executor.executeCommand( getAndroidSdk().getAaptPath(), commands, project.getBasedir(), false ); throw new MojoExecutionException( "", e ); generateCorrectRJavaForAarDependencies( resGenerator ); getLog().info( "Adding R gen folder to compile classpath: " + genDirectory ); project.addCompileSourceRoot( genDirectory.getAbsolutePath() );
if (!deleted) getLog().warn("Couldn't delete the temporary assembly descriptor file!"); List<String> appJars = IO.find("*-uber-jar.jar").in(project.getBuild().getDirectory()).getNames(); uberJar = appJar.toFile().getAbsolutePath(); } catch (IOException e) { throw new MojoExecutionException("Couldn't rename the file! " + ABORT, e); getLog().info(""); getLog().info("The main class is: " + mainClass); throw new MojoExecutionException("Couldn't add the JAR manifest! " + ABORT, e);