2

Maven 2.2.1

こんにちは、私はこのdirツリーを持っています:

.
├── pom.xml
├── src
│   ├── main
│   │   └── webapp
│   │       ├── META-INF
│   │       ├── **resources**
│   │       │   ├── **bootstrap**
│   │       │   │   ├── **bootstrap**
│   │       │   │   │   ├── css
│   │       │   │   │   ├── img
│   │       │   │   │   └── js
│   │       │   │   ├── docs
│   │       │   │   ├── img
│   │       │   │   ├── js
│   │       │   │   ├── less
│   │       │   │   ├── LICENSE
│   │       │   │   ├── Makefile
│   │       │   │   ├── package.json
│   │       │   │   └── README.md
│   │       │   ├── cms
│   │       │   └── **static**
│   │       │       ├── css
│   │       │       ├── feeds
│   │       │       ├── img
│   │       │       ├── js
│   │       │       └── less
│   │       ├── WEB-INF

私がdouble*で強調したところ興味深いディレクトリ...

パッケージ時にresources/bootstrap、最終的なWARから除外することと、内部コピーすることの両方を試みています。resources/bootstrap/boostrapresources/static

言い換えれば、私は以下を取得する必要があります:

.
│   │       ├── META-INF
│   │       ├── **resources**
│   │       │   ├── cms
│   │       │   └── **static**
│   │       │       ├── **bootstrap**
│   │       │       │   ├── css
│   │       │       │   ├── img
│   │       │       │   └── js
│   │       │       ├── css
│   │       │       ├── feeds
│   │       │       ├── img
│   │       │       ├── js
│   │       │       └── less
│   │       ├── WEB-INF

不幸にもいじり回っていますmaven-war-pluginが、それでも目的の結果を得ることができません。

これが私のpomの関連部分の最新バージョンです:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.2</version>
    <configuration>
        <packagingExcludes>WEB-INF/**.tld</packagingExcludes>
        <warSourceExcludes>resources/bootstrap</warSourceExcludes>
        <webResources>
            <resource>
                <!-- this is relative to the pom.xml directory -->
                <directory>src/main/webapp/resources/bootstrap</directory>
                <!-- override the destination directory for this resource -->
                <targetPath>resources/static</targetPath>
                <includes>
                    <include>bootstrap/**</include>
                </includes>
            </resource>
        </webResources>                 
    </configuration>
</plugin>

フォローアップのヒントを事前にありがとう!

4

1 に答える 1

2

あなたは近くにいました。ツリー全体(ディレクトリとそのすべての子)を省略するにはresources/bootstrap/**、パラメータを指定する必要があります。warSourcesExcludesディレクトリを除外するだけresources/bootstrapでは何も起こりません。これは、そのディレクトリのすべての子がまだ含まれているため、子をコピーして親ディレクトリが存在しない場合にディレクトリが自動的に作成されるためです。

したがって、構成には次のものが必要です。

    <configuration>
        ...
        <warSourceExcludes>resources/bootstrap/**</warSourceExcludes>
        ...
    </configuration>

cleanそして、戦争を再びパッケージ化する前に、Mavenを実行することを忘れないでください。

于 2012-05-30T15:20:01.337 に答える