Search in sources :

Example 1 with FileSet

use of org.apache.maven.plugin.assembly.model.FileSet in project fabric8-maven-plugin by fabric8io.

the class JavaExecGenerator method createFileSet.

private FileSet createFileSet(String sourceDir, String outputDir, String fileMode, String directoryMode) {
    FileSet fileSet = new FileSet();
    fileSet.setDirectory(sourceDir);
    fileSet.setOutputDirectory(outputDir);
    fileSet.setFileMode(fileMode);
    fileSet.setDirectoryMode(directoryMode);
    return fileSet;
}
Also used : FileSet(org.apache.maven.plugin.assembly.model.FileSet)

Example 2 with FileSet

use of org.apache.maven.plugin.assembly.model.FileSet in project fabric8-maven-plugin by fabric8io.

the class JavaExecGenerator method addAssembly.

protected void addAssembly(AssemblyConfiguration.Builder builder) throws MojoExecutionException {
    String assemblyRef = getConfig(Config.assemblyRef);
    if (assemblyRef != null) {
        builder.descriptorRef(assemblyRef);
    } else {
        if (isFatJar()) {
            FatJarDetector.Result fatJar = detectFatJar();
            Assembly assembly = new Assembly();
            MavenProject project = getProject();
            if (fatJar == null) {
                DependencySet dependencySet = new DependencySet();
                dependencySet.addInclude(project.getGroupId() + ":" + project.getArtifactId());
                assembly.addDependencySet(dependencySet);
            } else {
                FileSet fileSet = new FileSet();
                File buildDir = new File(project.getBuild().getDirectory());
                fileSet.setDirectory(toRelativePath(buildDir, project.getBasedir()));
                fileSet.addInclude(toRelativePath(fatJar.getArchiveFile(), buildDir));
                fileSet.setOutputDirectory(".");
                assembly.addFileSet(fileSet);
            }
            assembly.addFileSet(createFileSet("src/main/fabric8-includes/bin", "bin", "0755", "0755"));
            assembly.addFileSet(createFileSet("src/main/fabric8-includes", ".", "0644", "0755"));
            builder.assemblyDef(assembly);
        } else {
            builder.descriptorRef("artifact-with-dependencies");
        }
    }
    ;
}
Also used : MavenProject(org.apache.maven.project.MavenProject) FileSet(org.apache.maven.plugin.assembly.model.FileSet) DependencySet(org.apache.maven.plugin.assembly.model.DependencySet) File(java.io.File) Assembly(org.apache.maven.plugin.assembly.model.Assembly)

Aggregations

FileSet (org.apache.maven.plugin.assembly.model.FileSet)2 File (java.io.File)1 Assembly (org.apache.maven.plugin.assembly.model.Assembly)1 DependencySet (org.apache.maven.plugin.assembly.model.DependencySet)1 MavenProject (org.apache.maven.project.MavenProject)1