use of org.apache.maven.artifact.DependencyResolutionRequiredException in project cuke4duke by cucumber.
the class AbstractJRubyMojo method getProject.
protected Project getProject() throws MojoExecutionException {
Project project = new Project();
project.setBaseDir(mavenProject.getBasedir());
project.setProperty("jruby.home", jrubyHome().getAbsolutePath());
project.addBuildListener(new LogAdapter());
Path jrubyClasspath = new Path(project);
project.addReference("jruby.classpath", jrubyClasspath);
try {
append(jrubyClasspath, testClasspathElements);
append(jrubyClasspath, compileClasspathElements);
append(jrubyClasspath, pluginArtifacts);
return project;
} catch (DependencyResolutionRequiredException e) {
throw new MojoExecutionException("error resolving dependencies", e);
}
}
use of org.apache.maven.artifact.DependencyResolutionRequiredException in project querydsl by querydsl.
the class AbstractExporterMojo method execute.
@SuppressWarnings("unchecked")
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (testClasspath) {
project.addTestCompileSourceRoot(targetFolder.getAbsolutePath());
} else {
project.addCompileSourceRoot(targetFolder.getAbsolutePath());
}
if (skip || !hasSourceChanges()) {
// prevent m2e from entering an infinite build cycle.
return;
}
ClassLoader classLoader = null;
try {
classLoader = getProjectClassLoader();
} catch (MalformedURLException | DependencyResolutionRequiredException e) {
throw new MojoFailureException(e.getMessage(), e);
}
Charset charset = sourceEncoding != null ? Charset.forName(sourceEncoding) : Charset.defaultCharset();
GenericExporter exporter = new GenericExporter(classLoader, charset);
exporter.setTargetFolder(targetFolder);
if (scala) {
try {
exporter.setSerializerClass((Class<? extends Serializer>) Class.forName("com.querydsl.scala.ScalaEntitySerializer"));
exporter.setTypeMappingsClass((Class<? extends TypeMappings>) Class.forName("com.querydsl.scala.ScalaTypeMappings"));
exporter.setCreateScalaSources(true);
} catch (ClassNotFoundException e) {
throw new MojoFailureException(e.getMessage(), e);
}
}
configure(exporter);
exporter.export(packages);
}
use of org.apache.maven.artifact.DependencyResolutionRequiredException in project maven-plugins by apache.
the class ManifestCreationFinalizer method finalizeArchiveCreation.
@Override
public void finalizeArchiveCreation(final Archiver archiver) {
if (archiveConfiguration != null) {
try {
Manifest manifest;
final File manifestFile = archiveConfiguration.getManifestFile();
if (manifestFile != null) {
Reader manifestFileReader = null;
try {
manifestFileReader = new InputStreamReader(new FileInputStream(manifestFile), "UTF-8");
manifest = new Manifest(manifestFileReader);
manifestFileReader.close();
manifestFileReader = null;
} catch (final FileNotFoundException e) {
throw new ArchiverException("Manifest not found: " + e.getMessage(), e);
} catch (final IOException e) {
throw new ArchiverException("Error processing manifest: " + e.getMessage(), e);
} finally {
IOUtil.close(manifestFileReader);
}
} else {
manifest = mavenArchiver.getManifest(session, project, archiveConfiguration);
}
if ((manifest != null) && (archiver instanceof JarArchiver)) {
final JarArchiver jarArchiver = (JarArchiver) archiver;
jarArchiver.addConfiguredManifest(manifest);
}
} catch (final ManifestException e) {
throw new ArchiverException("Error creating manifest: " + e.getMessage(), e);
} catch (final DependencyResolutionRequiredException e) {
throw new ArchiverException("Dependencies were not resolved: " + e.getMessage(), e);
}
}
}
use of org.apache.maven.artifact.DependencyResolutionRequiredException in project maven-plugins by apache.
the class AbstractJDepsMojo method addJDepsOptions.
protected void addJDepsOptions(Commandline cmd, Set<Path> dependenciesToAnalyze) throws MojoFailureException {
if (dotOutput != null) {
cmd.createArg().setValue("-dotoutput");
cmd.createArg().setFile(dotOutput);
}
if (verbose != null) {
if ("class".equals(verbose)) {
cmd.createArg().setValue("-verbose:class");
} else if ("package".equals(verbose)) {
cmd.createArg().setValue("-verbose:package");
} else {
cmd.createArg().setValue("-v");
}
}
try {
Collection<Path> cp = new ArrayList<>();
for (Path path : getClassPath()) {
if (!dependenciesToAnalyze.contains(path)) {
cp.add(path);
}
}
if (!cp.isEmpty()) {
cmd.createArg().setValue("-cp");
cmd.createArg().setValue(StringUtils.join(cp.iterator(), File.pathSeparator));
}
} catch (DependencyResolutionRequiredException e) {
throw new MojoFailureException(e.getMessage(), e);
}
if (include != null) {
cmd.createArg().setValue("-include");
cmd.createArg().setValue(include);
}
if (profile) {
cmd.createArg().setValue("-P");
}
if (module) {
cmd.createArg().setValue("-M");
}
if (apiOnly) {
cmd.createArg().setValue("-apionly");
}
if (recursive) {
cmd.createArg().setValue("-R");
}
// cmd.createArg().setValue( "-version" );
}
use of org.apache.maven.artifact.DependencyResolutionRequiredException in project maven-plugins by apache.
the class EjbMojo method generateEjb.
private File generateEjb() throws MojoExecutionException {
File jarFile = EjbHelper.getJarFile(outputDirectory, jarName, getClassifier());
getLog().info("Building EJB " + jarName + " with EJB version " + ejbVersion);
MavenArchiver archiver = new MavenArchiver();
archiver.setArchiver(jarArchiver);
archiver.setOutputFile(jarFile);
File deploymentDescriptor = new File(sourceDirectory, ejbJar);
checkEJBVersionCompliance(deploymentDescriptor);
try {
List<String> defaultExcludes = Lists.newArrayList(ejbJar, "**/package.html");
List<String> defaultIncludes = DEFAULT_INCLUDES_LIST;
IncludesExcludes ie = new IncludesExcludes(Collections.<String>emptyList(), excludes, defaultIncludes, defaultExcludes);
archiver.getArchiver().addDirectory(sourceDirectory, ie.resultingIncludes(), ie.resultingExcludes());
// FIXME: We should be able to filter more than just the deployment descriptor?
if (deploymentDescriptor.exists()) {
// EJB-34 Filter ejb-jar.xml
if (filterDeploymentDescriptor) {
filterDeploymentDescriptor(deploymentDescriptor);
}
archiver.getArchiver().addFile(deploymentDescriptor, ejbJar);
}
// create archive
archiver.createArchive(session, project, archive);
} catch (ArchiverException e) {
throw new MojoExecutionException("There was a problem creating the EJB archive: " + e.getMessage(), e);
} catch (ManifestException e) {
throw new MojoExecutionException("There was a problem creating the EJB archive: " + e.getMessage(), e);
} catch (IOException e) {
throw new MojoExecutionException("There was a problem creating the EJB archive: " + e.getMessage(), e);
} catch (DependencyResolutionRequiredException e) {
throw new MojoExecutionException("There was a problem creating the EJB archive: " + e.getMessage(), e);
} catch (MavenFilteringException e) {
throw new MojoExecutionException("There was a problem filtering the deployment descriptor: " + e.getMessage(), e);
}
return jarFile;
}
Aggregations