/** * If the specified version name cannot be properly parsed then fall back to * an automatic method. * If the version can be parsed then generate a version code from the * version components. In an effort to preseve uniqueness two digits * are allowed for both the minor and incremental versions. * @throws MojoExecutionException */ private void performVersionCodeUpdateFromVersion( Element manifestElement ) throws MojoExecutionException { String verString = project.getVersion(); getLog().debug( "Generating versionCode for " + verString ); String verCode = generateVersionCodeFromVersionName( verString ); getLog().info( "Setting " + ATTR_VERSION_CODE + " to " + verCode ); manifestElement.setAttribute( ATTR_VERSION_CODE, verCode ); project.getProperties().setProperty( "android.manifest.versionCode", String.valueOf( verCode ) ); }
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 );
private static void requireValidDockerFilePath(@Nonnull Log log, @Nonnull Path contextDirectory, @Nullable Path dockerfile) throws MojoFailureException { log.info("Path(dockerfile): " + dockerfile); log.info("Path(contextDirectory): " + contextDirectory); if (dockerfile == null && !Files.exists(contextDirectory.resolve("Dockerfile")) && !Files.exists(contextDirectory.resolve("dockerfile"))) { // user did not override the default value log.error("Missing Dockerfile in context directory: " + contextDirectory); throw new MojoFailureException("Missing Dockerfile in context directory: " + contextDirectory); } if (dockerfile != null) { if (!Files.exists(dockerfile)) { log.error("Missing Dockerfile at " + dockerfile); throw new MojoFailureException("Missing Dockerfile at " + dockerfile); } if (!dockerfile.startsWith(contextDirectory)) { log.error("Dockerfile " + dockerfile + " is not a child of the context directory: " + contextDirectory); throw new MojoFailureException("Dockerfile " + dockerfile + " is not a child of the context directory: " + contextDirectory); } } }
@Override public int getThreshold() { if ( delegate.isErrorEnabled() ) { return Logger.LEVEL_ERROR; } else if ( delegate.isWarnEnabled() ) { return Logger.LEVEL_WARN; } else if ( delegate.isInfoEnabled() ) { return Logger.LEVEL_INFO; } return Logger.LEVEL_DEBUG; }
@Override public void run() { if (watcher != null) { log.debug("stopping: watcher"); Try.run(watcher::stop).onFailure(ex -> log.debug("Stop of watcher resulted in error", ex)); } commands.forEach(cmd -> { log.debug("stopping: " + cmd); Try.run(cmd::stop).onFailure(ex -> log.error("Stop of " + cmd + " resulted in error", ex)); }); } }
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 );
@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)); log.debug("buildResource: " + buildResource); log.debug("buildResources: " + Arrays.deepToString(buildResources)); log.debug("includePath: " + includePath); log.debug("includePaths: " + Arrays.deepToString(includePaths)); log.debug("includeResource: " + includeResource); log.debug("includeResources: " + Arrays.deepToString(includeResources)); log.debug("linkPath: " + linkPath); log.debug("linkPaths: " + Arrays.deepToString(linkPaths)); log.debug("linkResource: " + linkResource); log.debug("linkResources: " + Arrays.deepToString(linkResources)); log.debug("preloadPath: " + preloadPath); log.debug("preloadPaths: " + Arrays.deepToString(preloadPaths)); log.debug("preloadResource: " + preloadResource); log.debug("preloadResources: " + Arrays.deepToString(preloadResources)); log.debug("resourcePath: " + resourcePath); log.debug("resourcePaths: " + Arrays.deepToString(resourcePaths)); log.debug("encoding: " + encoding); log.debug("outputDirectory: " + outputDirectory); log.debug("outputName: " + outputName); log.debug("generate: " + generate); log.debug("compile: " + compile); log.debug("deleteJniFiles: " + deleteJniFiles);
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 );
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, MojoFailureException { if(project !=null) { projectEncoding = project.getProperties().getProperty("project.build.sourceEncoding"); getLog().info("Swagger generation is skipped."); return; throw new MojoFailureException("You must configure at least one apiSources element"); throw new MojoExecutionException("You may use an old version of swagger which is not supported by swagger-maven-plugin 2.0+\n" + "swagger-maven-plugin 2.0+ only supports swagger-core 1.3.x"); throw new MojoExecutionException("You may use an old version of swagger which is not supported by swagger-maven-plugin 3.0+\n" + "swagger-maven-plugin 3.0+ only supports swagger spec 2.0"); getLog().debug(apiSources.toString()); throw new MojoFailureException(e.getMessage(), e); } catch (Exception e) { throw new MojoExecutionException(e.getMessage(), e);
@Override public void execute() throws MojoExecutionException, MojoFailureException { if ( getJack().isEnabled() ) { //proguard is handled by Jack return; } ConfigHandler configHandler = new ConfigHandler( this, this.session, this.execution ); configHandler.parseConfiguration(); if ( !parsedSkip ) { if ( parsedConfig.exists() ) { // TODO: make the property name a constant sometime after switching to @Mojo project.getProperties().setProperty( "android.proguard.obfuscatedJar", obfuscatedJar ); executeProguard(); } else { getLog().info( String .format( "Proguard skipped because the configuration file doesn't exist: %s", parsedConfig ) ); } } }
getLog().info( "Setting " + ATTR_VERSION_NAME + " to " + parsedVersionName ); manifestElement.setAttribute( ATTR_VERSION_NAME, parsedVersionName ); dirty = true; getLog().info( "Setting " + ATTR_VERSION_CODE + " to " + parsedVersionCode ); manifestElement.setAttribute( ATTR_VERSION_CODE, String.valueOf( parsedVersionCode ) ); dirty = true; getLog().info( "Setting " + ATTR_SHARED_USER_ID + " to " + parsedSharedUserId ); manifestElement.setAttribute( ATTR_SHARED_USER_ID, parsedSharedUserId ); dirty = true; getLog().info( "Testing if node " + node.getNodeName() + " is application" ); if ( node.getNodeType() == Node.ELEMENT_NODE ) getLog().info( "Setting " + ATTR_DEBUGGABLE + " to " + parsedDebuggable ); element.setAttribute( ATTR_DEBUGGABLE, String.valueOf( parsedDebuggable ) ); dirty = true; getLog().info( "Setting " + ELEM_COMPATIBLE_SCREENS ); updateCompatibleScreens( doc, manifestElement ); dirty = true; getLog().warn( "Could not remove old " + manifestFile ); getLog().info( "Made changes to manifest file, updating " + manifestFile ); writeManifest( manifestFile, doc ); getLog().info( "No changes found to write to manifest file" );
public void execute() throws MojoExecutionException, MojoFailureException { final Properties projectProperties = this.project.getProperties(); final File agentJarFile = pluginArtifactMap.get(SCOTT_ARTIFACT_NAME).getFile(); String arguments = getArgument(agentJarFile); getLog().info(ARG_LINE + " set to " + arguments); projectProperties.setProperty(ARG_LINE, arguments); }
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 ); for ( AbstractInputStreamContent contentGraphic : contentGraphicList ) getLog().info( "Uploading " + imageType + " " + i + " out of " + contentGraphicList.size() ); images.upload( packageName, editId, locale, imageType, contentGraphic ).execute(); i++; 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); }
@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); } }
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); } finally { getSettings().cleanup();
final String msg = String.format("Fatal exception(s) analyzing %s", getProject().getName()); if (this.isFailOnError()) { throw new MojoExecutionException(msg, returnEx); getLog().error(msg); if (getLog().isDebugEnabled()) { getLog().debug(returnEx); final String msg = String.format("Exception(s) analyzing %s", getProject().getName()); if (getLog().isDebugEnabled()) { getLog().debug(msg, returnEx);
@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); } } }