Refine search
Build build = model.getBuild(); build.setDirectory( alignToBaseDirectory( build.getDirectory(), basedir ) ); build.setSourceDirectory( alignToBaseDirectory( build.getSourceDirectory(), basedir ) ); build.setTestSourceDirectory( alignToBaseDirectory( build.getTestSourceDirectory(), basedir ) ); resource.setDirectory( alignToBaseDirectory( resource.getDirectory(), basedir ) ); resource.setDirectory( alignToBaseDirectory( resource.getDirectory(), basedir ) ); Reporting reporting = model.getReporting();
public static Resource cloneResource( Resource src ) { Resource result = null; if ( src != null ) { result = new Resource(); result.setDirectory( src.getDirectory() ); result.setExcludes( cloneListOfStrings( src.getExcludes() ) ); result.setFiltering( src.isFiltering() ); result.setIncludes( cloneListOfStrings( src.getIncludes() ) ); result.setMergeId( src.getMergeId() ); result.setTargetPath( src.getTargetPath() ); } return result; }
public void addTestResource( MavenProject project, String resourceDirectory, List includes, List excludes ) { Resource resource = new Resource(); resource.setDirectory( resourceDirectory ); resource.setIncludes( includes ); resource.setExcludes( excludes ); project.addTestResource( resource ); }
public void addResource( MavenProject project, String resourceDirectory, List includes, List excludes ) { Resource resource = new Resource(); resource.setDirectory( resourceDirectory ); resource.setIncludes( includes ); resource.setExcludes( excludes ); project.addResource( resource ); }
getLog().info( "NPANDAY-1500-000: No resources found" ); return; File defaultTargetDirectory = new File( project.getBuild().getDirectory(), "assembly-resources/resource" ); getLog().debug("NPANDAY-1500-002: Target directory:" + defaultTargetDirectory); getLog().debug("NPANDAY-1500-003: Project:" + project); String resourceTargetPath = resource.getTargetPath(); File targetDirectory = (resourceTargetPath != null && resourceTargetPath.length() > 0? new File(project.getBuild().getDirectory() + "/" + resourceTargetPath) : defaultTargetDirectory); File file = new File( resource.getDirectory() ); if ( file.exists() ) copyResourceDirectory( file, targetDirectory, resource.getIncludes(), resource.getExcludes() ); FileUtils.copyDirectory( new File( project.getBasedir(), "src/main/config" ), new File( project.getBuild().getDirectory() ), "*.exe.config", null ); throw new MojoExecutionException( "NPANDAY-1500-004: Failed to copy config file.", e );
public void execute() throws MojoExecutionException, MojoFailureException { String appFolder = this.appDirectory.getAbsolutePath(); getLog().info("attaching test resource " + appFolder); Resource appFolderResource = new Resource(); appFolderResource.setDirectory(appFolder); this.project.addTestResource(appFolderResource); } }
getLog().info("add to java classpath: " + rubySourceDirectory.getAbsolutePath()); Resource resource = new Resource(); resource.setDirectory(rubySourceDirectory.getAbsolutePath()); project.getBuild().getResources().add(resource); throw new MojoExecutionException("error in executing jruby", e); } catch (final ScriptException e) { throw new MojoExecutionException("error in executing jruby", e); } finally {
myProject.addCompileSourceRoot(targetDirectory.getAbsolutePath()); w.close(); Resource resource = new Resource(); resource.setDirectory(targetResourceDirectory.getAbsolutePath()); resource.addInclude(targetResourceSpringBeansFile); myProject.addResource(resource);
generator.setResourceLocation(((Resource)project.getBuild().getResources().get( 0 )).getDirectory()); generator.setFollowComplexTypes(followComplexTypes); generator.setIncludes( includes ); for ( Iterator d = project.getDependencies().iterator(); d.hasNext(); ) { Dependency dep = (Dependency) d.next(); getLog().error( "Unable to resolve " + artifact.getId() ); urls.add( new File(project.getBuild().getOutputDirectory()).toURI().toURL() ); getLog().error("Bad url: " + project.getBuild().getOutputDirectory() ); return; getLog().error("Could note load class: " + schemaClassName); return;
generator.setResourceLocation(((Resource)project.getBuild().getResources().get( 0 )).getDirectory()); generator.setSchemaSourceDirectory(schemaSourceDirectory); getLog().error("Could not load class: " + complexBindingBaseClass); return; getLog().error("Could not load class: " + simpleBindingBaseClass); return; List l = project.getCompileClasspathElements(); for ( Iterator i = l.iterator(); i.hasNext(); ) { String element = (String) i.next(); List d = project.getDependencies(); getLog().error( e ); return;
private void addResources(Resource resource) throws MojoExecutionException { getLog().info( String.format("Adding resources [%s] to [%s]", resource .getDirectory(), resource.getTargetPath())); String[] fileNames = getFilesToCopy(resource); for (int i = 0; i < fileNames.length; i++) { String targetFileName = fileNames[i]; if (resource.getTargetPath() != null) { targetFileName = resource.getTargetPath() + File.separator + targetFileName; } try { jarArchiver.addFile(new File(resource.getDirectory(), fileNames[i]), targetFileName); } catch (ArchiverException e) { throw new MojoExecutionException( "Unable to add resources to JAR file", e); } } }
public static boolean haveResourcesChanged(Log log, MavenProject project, BuildContext buildContext, String suffix) { String baseDir = project.getBasedir().getAbsolutePath(); for (Resource r : project.getBuild().getResources()) { File file = new File(r.getDirectory()); if (file.isAbsolute()) { file = new File(r.getDirectory().substring(baseDir.length() + 1)); } String path = file.getPath() + "/" + suffix; if (log.isDebugEnabled()) { log.debug("checking if " + path + " (" + r.getDirectory() + "/" + suffix + ") has changed."); } if (buildContext.hasDelta(path)) { log.debug("Indeed " + suffix + " has changed."); return true; } } return false; }
validateStringNotEmpty( "modelVersion", result, model.getModelVersion() ); validateId( "groupId", result, model.getGroupId() ); validateId( "artifactId", result, model.getArtifactId() ); validateStringNotEmpty( "packaging", result, model.getPackaging() ); if ( build != null ) for ( Iterator it = build.getPlugins().iterator(); it.hasNext(); ) for ( Iterator it = build.getResources().iterator(); it.hasNext(); ) validateStringNotEmpty( "build.resources.resource.directory", result, r.getDirectory() ); for ( Iterator it = build.getTestResources().iterator(); it.hasNext(); ) validateStringNotEmpty( "build.testResources.testResource.directory", result, r.getDirectory() );
public void addResource( Resource resource ) { getProject().addResource( resource ); if ( getLog().isDebugEnabled() ) { getLog().debug( "Added resource: " + resource.getDirectory() ); } } }
/** * Add the resource to the project. * * @param resource the resource to add */ public void addResource( Resource resource ) { getProject().addTestResource( resource ); if ( getLog().isDebugEnabled() ) { getLog().debug( "Added test resource: " + resource.getDirectory() ); } } }
public void execute() throws MojoExecutionException { try { project.addCompileSourceRoot(javaOutputDirectory.getAbsolutePath()); project.addTestCompileSourceRoot(testJavaOutputDirectory.getAbsolutePath()); Resource res = new Resource(); res.setDirectory(openCLOutputDirectory.getAbsolutePath()); project.addResource(res); res = new Resource(); res.setDirectory(testOpenCLOutputDirectory.getAbsolutePath()); project.addTestResource(res); generateAll(sourcesDirectory, javaOutputDirectory, openCLOutputDirectory); generateAll(testSourcesDirectory, testJavaOutputDirectory, testOpenCLOutputDirectory); } catch (MojoExecutionException e ) { throw e; } catch (Exception e ) { throw new MojoExecutionException( "Error running JNAerator", e ); } } }
private void writeTaglibXml() throws MojoExecutionException { try { File taglibsXml = new File(project.getBasedir(), "target/taglib.xml"); taglibsXml.getParentFile().mkdirs(); Tags tags = TXW.create(Tags.class,new StreamSerializer(new FileOutputStream(taglibsXml))); for(Resource res : (List<Resource>)project.getResources()) scanTagLibs(new File(res.getDirectory()),"",tags); tags.commit(); } catch (IOException e) { throw new MojoExecutionException("Failed to generate taglibs.xml",e); } }
/** * Finds all resource directories. */ protected void findResourceDirs() { resourceDirs = new ArrayList<>(); for (Object resource : mavenProject.getBuild().getResources()) { if (resource instanceof Resource) { String name = ((Resource) resource).getDirectory(); if (name != null) { getLog().debug("found resource directory " + name); resourceDirs.add(name); } } } }
Resource[] getResources() throws MojoExecutionException { final Resource resourceNonGenerated = new Resource(); resourceNonGenerated.setDirectory(getTopDirectory().getPath()); try { addNonPartialsToResources(getTopDirectory(),resourceNonGenerated); } catch (CodeGenException e) { throw new MojoExecutionException("Couldn't add non partial specifications to resources"); } if (resourceNonGenerated.getIncludes().isEmpty()) { resourceNonGenerated.addExclude("**/*"); } Resource resourceGenerated = new Resource(); final File specificationOutputDir = getSpecificationOutput(); resourceGenerated.setDirectory(specificationOutputDir.getPath()); resourceGenerated.addInclude("**/*.json"); final Resource[] resources = {resourceNonGenerated,resourceGenerated}; return resources; }