Ugene Skywalker
Ugene Skywalker

Reputation: 3

Maven assembly plugin generate zip with bat or sh file

I'm using IDEA with Maven; I want to use maven-assembly-plugin to generate a zip which has lib, bin and README. I use the command mvn package to assemble the zip.
But the zip doesn't have the run.bat or run.sh. My question is: should the content of run.bat or run.sh be written by myself, or is it generated automatically by Maven?

The following is a part of file in my IDEA with Maven.
enter image description here

assembly.xml:

<assembly>
<id>bin</id>
<formats>
    <format>zip</format>
</formats>
<dependencySets>
    <dependencySet>
        <useProjectArtifact>true</useProjectArtifact>
        <outputDirectory>lib</outputDirectory>
    </dependencySet>
</dependencySets>
<fileSets>
    <fileSet>
        <outputDirectory>/</outputDirectory>
        <includes>
            <include>README.txt</include>
        </includes>
    </fileSet>
    <fileSet>
        <directory>src/main/scripts</directory>
        <outputDirectory>/bin</outputDirectory>
        <includes>
            <include>run.sh</include>
            <include>run.bat</include>
        </includes>
    </fileSet>
</fileSets>

pom.xml:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.2.1</version>
            <configuration>
                <descriptors>
                    <descriptor>src/main/assembly/assembly.xml</descriptor>
                </descriptors>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Upvotes: 0

Views: 1561

Answers (1)

bedrin
bedrin

Reputation: 4586

Assembly plugin does not generate any shell wrappers (like run.bar or run.sh) for you - it only assembles an archive based on the rules defines in assemble desriptor.

You'll have to create a run.bat and run.sh on your own

Upvotes: 2

Related Questions