سؤال

I currently have this folder structure in my project

CTIConnector
|- src
   |-main
      |-java
      |-resources
      |-webapp

After using mvn deploy the target folder contains a jar, holding the resources folder. But i would like to also have the webapp folder in the same folder as the jar ( not inside the jar! ). Can someone please tell me how to do this :) ?

هل كانت مفيدة؟

المحلول

You can configure the maven-resources-plugin to put things where you want them (it's what runs in the process-resources lifecycle phase anyway: Maven Build Lifecycle). Have a look at the copy-resources goal for details. Essentially you'll be looking at something along the lines of this:

<project
    ...
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.5</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/webapp</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/webapp</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    ...
    </build>
</project>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top