Search in sources :

Example 1 with DependencySet

use of org.apache.maven.plugin.assembly.model.DependencySet 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

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