开发者

Maven WebResources keeps throwing error

I've got maven project that I want to be able to move some properties files to the outputted .war file so the property placeholders within spring will be able to make use of the properties files.

The current directory structure is:

|- src
   |- main
   |- properties
      |- dev
      |- int
      |- live
   |- test
|- pom.xml

I want to be able to take the src/properties/dev files and put them in the war file for the placeholders. However currently I have the following configuration section in my pom.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.0.2</version>
    <configuration>
        <webResources>
            <resource>
                <directory>src/properties/dev/</directory>
            </resource>
        </webResources>
    </configuration>
</plugin>

Then I keep getting the following error:

[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] basedir src\properties\dev does not exist
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.IllegalStateException: basedir src\properties\dev does not exist
    at org.codehaus.plexus.util.DirectoryScanner.scan(DirectoryScanner.java:542)
    at org.apache.maven.plugin.war.AbstractWarMojo.getWarFiles(AbstractWarMojo.java:824)
    at org.apache.maven.plugin.war.AbstractWarMojo.copyResources(AbstractWarMojo.java:408)
    at org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:518)
    at org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:347)
    at org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:164)
    at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:130)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:540)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:519)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
    at开发者_StackOverflow中文版 org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:41)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7 seconds
[INFO] Finished at: Tue Jan 18 10:02:17 GMT 2011
[INFO] Final Memory: 25M/62M
[INFO] ------------------------------------------------------------------------

I know it exists, but there seems to be no information on why I would be getting this error, I was advised by a friend that it may be related to properties not being a source-code folder, but I've tried adding the codehaus plugin that allows you to add new source folders and that didn't seem to help.


I think you have a multi-project build. Here is an issue related to this, which has been fixed in 2.1-Alpha.

Perhaps you should try using <version>2.1.1<version> instead of 2.0.2

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜