문제

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