org.apache.maven.plugin.MojoFailureException.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(13.1k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中org.apache.maven.plugin.MojoFailureException.<init>()方法的一些代码示例,展示了MojoFailureException.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MojoFailureException.<init>()方法的具体详情如下:
包路径:org.apache.maven.plugin.MojoFailureException
类名称:MojoFailureException
方法名:<init>

MojoFailureException.<init>介绍

[英]Construct a new MojoFailureException exception providing the source and a short and long message: these messages are used to improve the message written at the end of Maven build.
[中]构造一个新的MojoFailureException异常,提供源代码和一条长短消息:这些消息用于改进Maven构建结束时编写的消息。

代码示例

代码示例来源:origin: spotify/dockerfile-maven

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);
  }
 }
}

代码示例来源:origin: apache/drill

report.add(moveIfChanged(file, tmpPath));
if (!file.delete()) {
 throw new MojoFailureException(format("can not delete %s", file));
 throw new MojoFailureException(format("%s should start with %s", absPath, tmpPath));
 report.addNew();
} else if (!FileUtils.contentEquals(file, outputFile)) {
 getLog().info(format("%s has changed", relPath));
 if (!outputFile.delete()) {
  throw new MojoFailureException(format("can not delete %s", outputFile));
 File parentDir = outputFile.getParentFile();
 if (parentDir.exists() && !parentDir.isDirectory()) {
  throw new MojoFailureException(format("can not move %s to %s as %s is not a dir", file, outputFile, parentDir));
  throw new MojoFailureException(format("can not move %s to %s as dir %s can not be created", file, outputFile, parentDir));
  throw new MojoFailureException(format("can not delete %s", file));

代码示例来源:origin: apache/drill

@Override
 public void notifyProgressEvent(
   Engine engine, int event,
   File src, int pMode,
   Throwable error, Object param)
   throws Exception {
  if (event == EVENT_END_PROCESSING_SESSION) {
   getLog().info(format("Freemarker generation took %dms", sw.elapsed(TimeUnit.MILLISECONDS)));
   sw.reset();
   Report report = moveIfChanged(tmp, tmpPathNormalized);
   if (!tmp.delete()) {
    throw new MojoFailureException(format("can not delete %s", tmp));
   }
   getLog().info(format("Incremental output update took %dms", sw.elapsed(TimeUnit.MILLISECONDS)));
   getLog().info(format("new: %d", report.newFiles));
   getLog().info(format("changed: %d", report.changedFiles));
   getLog().info(format("unchanged: %d", report.unchangedFiles));
  }
 }
} );

代码示例来源:origin: jooby-project/jooby

@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);
  }
 }
}

代码示例来源:origin: simpligility/android-maven-plugin

getLog().info( deviceLogLinePrefix + "Attempting to start " + info.packageName + "/" 
    + info.activity );
if ( shellOutput.getOutput().contains( "Error" ) )
  throw new MojoFailureException( shellOutput.getOutput() );
  if ( pid == -1 )
    throw new MojoFailureException( "Cannot find stated process " + info.packageName );
  getLog().info(
    deviceLogLinePrefix + "Process " + debugPort + " launched"
  );
    throw new MojoFailureException( 
      "Cannot create forward tcp: " + debugPort 
        + " jdwp: " + pid, ex 
throw new MojoFailureException( deviceLogLinePrefix + "Input/Output error", ex );
throw new MojoFailureException( deviceLogLinePrefix + "Command timeout", ex );
throw new MojoFailureException( deviceLogLinePrefix + "ADB rejected the command", ex );
throw new MojoFailureException( deviceLogLinePrefix + "Unresponsive command", ex );

代码示例来源:origin: runelite/runelite

throw new MojoFailureException("unable to open file", ex);
log.info("Assembled " + count + " scripts");

代码示例来源:origin: simpligility/android-maven-plugin

if ( mavenTestSkip )
  getLog().info( "maven.test.skip set - skipping tests" );
  return false;
  getLog().info( "maven.skip.tests set - skipping tests" );
  return false;
  getLog().info( "android.test.skip set - skipping tests" );
  return false;
throw new MojoFailureException( "android.test.skip must be configured as 'true', 'false' or 'auto'." );

代码示例来源:origin: apache/drill

throw new MojoFailureException("can not write to output dir: " + outputPath);
throw new MojoFailureException("templates not found in dir: " + outputPath);
break;
default:
 throw new MojoFailureException("scope must be compile or test");
getLog().info(format("Freemarker generation:\n scope: %s,\n config: %s,\n templates: %s",
  scope, config.getAbsolutePath(), templatesPath));
final File tmp = Files.createTempDirectory("freemarker-tmp").toFile();
 getLog().info("Adding maven data loader");
 settings.setEngineAttribute(MavenDataLoader.MAVEN_DATA_ATTRIBUTE, new MavenData(project));
 settings.add(Settings.NAME_DATA, format("maven: %s()", MavenDataLoader.class.getName()));
throw new MojoFailureException(MiscUtil.causeMessages(e), e);

代码示例来源:origin: simpligility/android-maven-plugin

getLog().info( "Attempting to update manifest " + destinationManifestFile );
getLog().debug( "    usesSdk=" + parsedUsesSdk );
getLog().debug( "    versionName=" + parsedVersionName );
  throw new MojoFailureException( "XML I/O error: " + destinationManifestFile, e );
  throw new MojoFailureException( "Unable to prepare XML parser", e );
  throw new MojoFailureException( "Unable to parse XML: " + destinationManifestFile, e );
  throw new MojoFailureException( "Unable write XML: " + destinationManifestFile, e );

代码示例来源:origin: simpligility/android-maven-plugin

try
  getLog().info( "Deleting the old " + imageType );
    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++;

代码示例来源:origin: jeremylong/DependencyCheck

final String msg = "Unable to purge the local NVD when using a non-default connection string";
if (this.isFailOnError()) {
  throw new MojoFailureException(msg);
  if (db.exists()) {
    if (db.delete()) {
      getLog().info("Database file purged; local copy of the NVD has been removed");
    } else {
      final String msg = String.format("Unable to delete '%s'; please delete the file manually", db.getAbsolutePath());
      if (this.isFailOnError()) {
        throw new MojoFailureException(msg);
    final String msg = String.format("Unable to purge database; the database file does not exist: %s", db.getAbsolutePath());
    if (this.isFailOnError()) {
      throw new MojoFailureException(msg);

代码示例来源:origin: swagger-api/swagger-core

public void execute() throws MojoExecutionException, MojoFailureException
    getLog().info( "Skipping OpenAPI specification resolution" );
    return;
  getLog().info( "Resolving OpenAPI specification.." );
            } catch (Exception e1) {
              getLog().error( "Error reading/deserializing openapi file" , e);
              throw new MojoFailureException(e.getMessage(), e);
    throw new MojoFailureException(e.getMessage(), e);
    throw new MojoFailureException(e.getMessage(), e);
  } catch (IOException e) {
    getLog().error( "Error writing API specification" , e);

代码示例来源:origin: simpligility/android-maven-plugin

if ( versionNameAttrib == null || ! StringUtils.equals( parsedVersionName, versionNameAttrib.getValue() ) )
  getLog().info( "Setting " + ATTR_VERSION_NAME + " to " + parsedVersionName );
  manifestElement.setAttribute( ATTR_VERSION_NAME, parsedVersionName );
  dirty = true;
    || ( parsedVersionCodeAutoIncrement && parsedVersionCodeUpdateFromVersion ) )
  throw new MojoFailureException( "versionCodeAutoIncrement, versionCodeUpdateFromVersion and versionCode "
      + "are mutual exclusive. They cannot be specified at the same time. Please specify either "
      + "versionCodeAutoIncrement, versionCodeUpdateFromVersion or versionCode!" );
    getLog().info( "Setting " + ATTR_VERSION_CODE + " to " + parsedVersionCode );
    manifestElement.setAttribute( ATTR_VERSION_CODE, String.valueOf( parsedVersionCode ) );
    dirty = true;
      .equals( parsedSharedUserId, sharedUserIdAttrib.getValue() ) )
    getLog().info( "Setting " + ATTR_SHARED_USER_ID + " to " + parsedSharedUserId );
    manifestElement.setAttribute( ATTR_SHARED_USER_ID, parsedSharedUserId );
    dirty = true;

代码示例来源:origin: simpligility/android-maven-plugin

throw new MojoFailureException( "\n\n One of the parameters android.deployapk.packagename "
    + "or android.deployapk.filename is required. \n" );
getLog().info( "Ignoring invalid file parameter." );
getLog().debug( response.getMessage() );

代码示例来源:origin: simpligility/android-maven-plugin

/**
   * Deploy the app to the attached devices and emulators.
   *
   * @throws MojoExecutionException
   * @throws MojoFailureException
   */
  public void execute() throws MojoExecutionException, MojoFailureException
  {
    ConfigHandler configHandler = new ConfigHandler( this, this.session, this.execution );
    configHandler.parseConfiguration();
    
    ValidationResponse response = DeployApk.validFileParameter( parsedFilename );
    if ( response.isValid() ) 
    {   
      getLog().info( "Deploying apk file at " + parsedFilename );
      deployApk( parsedFilename );
    } 
    else 
    {
      throw new MojoFailureException( response.getMessage() );
    }
  }
}

代码示例来源:origin: eirslett/frontend-maven-plugin

@Override
public void execute() throws MojoFailureException {
  if (testFailureIgnore && !isTestingPhase()) {
    getLog().info("testFailureIgnore property is ignored in non test phases");
  }
  if (!(skipTestPhase() || skipExecution())) {
    if (installDirectory == null) {
      installDirectory = workingDirectory;
    }
    try {
      execute(new FrontendPluginFactory(workingDirectory, installDirectory,
          new RepositoryCacheResolver(repositorySystemSession)));
    } catch (TaskRunnerException e) {
      if (testFailureIgnore && isTestingPhase()) {
        getLog().error("There are test failures.\nFailed to run task: " + e.getMessage(), e);
      } else {
        throw new MojoFailureException("Failed to run task", e);
      }
    } catch (FrontendException e) {
      throw MojoUtils.toMojoFailureException(e);
    }
  } else {
    getLog().info("Skipping execution.");
  }
}

代码示例来源:origin: simpligility/android-maven-plugin

getLog().info( deviceLogLinePrefix + "Running tests for specified test package: " + str );
  getLog().info( deviceLogLinePrefix + "Running tests for specified test classes/methods: " 
      + parsedClasses );
getLog().info( deviceLogLinePrefix +  "Running instrumentation tests in " 
    + parsedInstrumentationPackage );
try
  if ( testRunListener.hasFailuresOrErrors() && !testFailSafe )
    throw new MojoFailureException( deviceLogLinePrefix + "Tests failed on device." );
    throw new MojoFailureException( deviceLogLinePrefix + "Test run failed to complete: " 
        + testRunListener.getTestRunFailureCause() );
    throw new MojoFailureException( deviceLogLinePrefix +  testRunListener.getExceptionMessages() );

代码示例来源:origin: simpligility/android-maven-plugin

throw new MojoFailureException( "Incomplete listing" );
getLog().info( "Updating the listing for " + packageName );
final Listing listing = new Listing();
listing.setTitle( title );

代码示例来源:origin: simpligility/android-maven-plugin

getLog().info( deviceLogLinePrefix + "Running ui uiautomator tests in" + parsedJarFile );
try
  if ( testRunListener.hasFailuresOrErrors() && !isIgnoreTestFailures() )
    throw new MojoFailureException( deviceLogLinePrefix + "Tests failed on device." );
    throw new MojoFailureException( deviceLogLinePrefix + "Test run failed to complete: "
        + testRunListener.getTestRunFailureCause() );
    throw new MojoFailureException( deviceLogLinePrefix + testRunListener.getExceptionMessages() );

代码示例来源:origin: simpligility/android-maven-plugin

monkeyTestRunner.setMonitorNativeCrash( parsedMonitorNativeCrashes );
getLog().info( deviceLogLinePrefix + "Running ui monkey tests" );
try
  if ( testRunListener.hasFailuresOrErrors() && !isIgnoreTestFailures() )
    throw new MojoFailureException( deviceLogLinePrefix + "Tests failed on device." );
    throw new MojoFailureException( deviceLogLinePrefix + "Test run failed to complete: "
        + testRunListener.getTestRunFailureCause() );
    throw new MojoFailureException( deviceLogLinePrefix + testRunListener.getExceptionMessages() );

相关文章