Вопрос

Following is the Maven assembly plugin details from pom.xml of my project:

    <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.3</version>
        <executions>
            <execution>
                <id>make-assembly</id>
                <phase>package</phase>
                <goals>
                    <goal>single</goal>
                </goals>
                <configuration>
                    <descriptors>
                        <descriptor>src/main/assembly/prj-assembly.xml</descriptor>
                    </descriptors>
                    <finalName>myArtifact</finalName>
                    <outputDirectory>target/package</outputDirectory>
                    <workDirectory>target/assembly/work</workDirectory>
                    <includeBaseDirectory>false</includeBaseDirectory>
                </configuration>
            </execution>

        </executions>
    </plugin>

All works fine and artifacts are generated but problem is that a parent directory also gets generated with name of artifact. So artifact structure looks something like:

myArtifact.tar.gz
              |_myArtifact [This is the parent directory]
                        |_ myfolder
                                  |_myfiles

What i want is

myArtifact.tar.gz              
                |_ myfolder
                          |_myfiles

How can i achieve this?

EDIT:

Following are descriptor [prj-assembly.xml] details:

<assembly>
  <id>deploy</id>
  <formats>
    <format>tar.gz</format>
  </formats>
  <files>
    <file>
      <source>src/main/scripts/f1.sh</source>
      <outputDirectory>bin</outputDirectory>
      <filtered>false</filtered>
      <lineEnding>unix</lineEnding>
      <fileMode>0755</fileMode>
    </file>
    <file>
      <source>src/main/scripts/install.sh</source>
      <outputDirectory>bin</outputDirectory>
      <filtered>false</filtered>
      <lineEnding>unix</lineEnding>
      <fileMode>0755</fileMode>
    </file>
    <file>
      <source>src/main/scripts/activate.sh</source>
      <outputDirectory>bin</outputDirectory>
      <filtered>false</filtered>
      <lineEnding>unix</lineEnding>
      <fileMode>0755</fileMode>
    </file>
  </files>
  <dependencySets>
    <dependencySet>
      <scope>runtime</scope>
      <outputDirectory>lib</outputDirectory>
    </dependencySet>
  </dependencySets>
</assembly>
Это было полезно?

Решение

The point is you didn't add the

<includeBaseDirectory>false</includeBaseDirectory>

in your assembly descriptor. The includeBaseDirectory does not belong to the configuration area of the plugin, cause the goal single does not has any kind of this configuration item.

Apart from that why are you changing the values of:

<outputDirectory>target/package</outputDirectory>
<workDirectory>target/assembly/work</workDirectory>

Другие советы

Try adding this to your assembly descriptor:

<includeBaseDirectory>false</includeBaseDirectory>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top