Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

Allow for a completely flat appassembler output #105

@tonyganchev

Description

@tonyganchev

Our product today consists of just a single executable jar-with-dependencies.
We want to have appassembler generate a startup batch and shell script but we cannot afford for backward compatibility reasons to follow the standard appassembler directory layout. What we need is a simple flat structure containing both the jar and the startup scripts.

I tried to make such a layout work with appassembler to no avail. The generated batch script always looks for the parent directory of the script and then looks for a nested directory $repositoryName}.

Are we missing something?

We've been testing with 1.10 and 2.1.0 versions of appassembler.

Our pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>

   <groupId>com.example.the</groupId>
   <artifactId>app</artifactId>

   <properties>
      <main.class>com.example.path.to.the.App</main.class>
      <product.name>the-app</product.name>
      <repo.name>.</repo.name>
   </properties>

   <dependencies>
      ...
   </dependencies>

   <build>
      <plugins>
         <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
               <archive>
                  <manifest>
                     <mainClass>${main.class}</mainClass>
                  </manifest>
               </archive>
               <descriptorRefs>
                  <descriptorRef>jar-with-dependencies</descriptorRef>
               </descriptorRefs>
               <finalName>${product.name}</finalName>
               <outputDirectory>${project.build.directory}/${repo.name}</outputDirectory>
            </configuration>
            <executions>
               <execution>
                  <id>assembly</id>
                  <phase>package</phase>
                  <goals>
                     <goal>single</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <configuration>
               <mainClass>${main.class}</mainClass>
            </configuration>
         </plugin>
         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>appassembler-maven-plugin</artifactId>
            <configuration>
               <repositoryName>${repo.name}</repositoryName>
               <binFolder>.</binFolder>
               <repositoryLayout>flat</repositoryLayout>
               <assembleDirectory>${project.build.directory}</assembleDirectory>
               <binFileExtensions>
                  <unix>.sh</unix>
               </binFileExtensions>
               <programs>
                  <program>
                     <id>${product.name}</id>
                     <mainClass>${main.class}</mainClass>
                  </program>
               </programs><includeConfigurationDirectoryInClasspath>false</includeConfigurationDirectoryInClasspath>
               <generateRepository>false</generateRepository>
               <useWildcardClassPath>true</useWildcardClassPath>
            </configuration>
            <executions>
               <execution>
                  <id>assemble</id>
                  <phase>package</phase>
                  <goals>
                     <goal>assemble</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
</project>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions