Maven远程资源插件问题
我知道关于这个话题还有很多其他的问题,我已经搜索并阅读了所有的问题,但到目前为止这些问题都没有帮助 共享资源的pom如下所示Maven远程资源插件问题,maven,Maven,我知道关于这个话题还有很多其他的问题,我已经搜索并阅读了所有的问题,但到目前为止这些问题都没有帮助 共享资源的pom如下所示 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.o
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.myorganization</groupId>
<artifactId>myapp</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>myapp-resources</artifactId>
<name>Resources Bundle</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
所以,这里它说,处理resourceBundle中的资源,并将它们放在共享资源目录中。但是,什么也没发生。当我尝试执行mvn remote resources:process
时,我收到一条错误消息,指出resourceBundles
的参数丢失或无效。如果我运行mvn安装
没有错误,但是当我尝试从shared resources
目录复制(maven resources plugin)任何内容时,它只是跳过该目录作为不存在的资源目录
此外,我试图为resourceBundle输入错误的名称,这给了我一个即时错误,即它不存在,因此我确信我已正确指定resourceBundle
谁能启发我?我做错了什么?谢谢
编辑:
将引用共享资源的pom部分添加为dependecy
<dependency>
<groupId>com.myorganization</groupId>
<artifactId>myapp-resources</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
同样有趣的是,插件配置中的
outputDirectory
设置似乎根本没有被选中,因为在调试日志中我可以看到outputDirectory
设置被设置为默认值。查看插件的文档,我看不到任何明显的错误
这意味着com.myorganization:myapp resources:1.0-SNAPSHOT
一定是因为某种原因出错了
确保您的本地回购协议中确实存在这种依赖关系。如果没有,请确保Maven可以从某处下载或在本地安装。我最终找到了解决方案。问题在于,我必须在pom配置中明确指定include,以便正确生成
remote resources.xml
,并在以后的过程中选择remote resource.xml
中列出的所有资源
因此,共享资源模块的最终pom应该如下所示(如果您希望包括所有内容):
4.0.0
com.myorganization
myapp
1.0-快照
myapp资源
资源包
org.apache.maven.plugins
maven远程资源插件
1.5
捆
**/*.*
附加说明
似乎
outputDirectory
对于process
目标没有任何影响,资源在插件中指定的默认路径上解包。我在pom配置中将其列为依赖项,没有抱怨。这个特定的jar安装在我的本地存储库中。我将编辑我的原始帖子来添加该部分。你能添加准确的错误消息吗?还要看看在这之前你是否能发现任何其他错误(也许这是一个后续问题)。最后,尝试使用-X
运行Maven以获得调试输出。也许那会包含一些有用的信息。
<dependency>
<groupId>com.myorganization</groupId>
<artifactId>myapp-resources</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<?xml version="1.0" encoding="UTF-8"?>
<remoteResourcesBundle xsi:schemaLocation="http://maven.apache.org/remote-resources/1.1.0 http://maven.apache.org/xsd/remote-resources-1.1.0.xsd"
xmlns="http://maven.apache.org/remote-resources/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<sourceEncoding>UTF-8</sourceEncoding>
</remoteResourcesBundle>
The parameters 'resourceBundles' for goal org.apache.maven.plugins:maven-remote-resources-plugin:1.5:process are missing or invalid -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-remote-resources-plugin:1.5:process (default-cli) on project lte-troubleshoting-solution: The parameters 'resourceBundles' for goal org.apache.maven.plugins:maven-remote-resources-plugin:1.5:process are missing or invalid
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:220)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginParameterException: The parameters 'resourceBundles' for goal org.apache.maven.plugins:maven-remote-resources-plugin:1.5:process are missing or invalid
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:581)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:534)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:97)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.myorganization</groupId>
<artifactId>myapp</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>myapp-resources</artifactId>
<name>Resources Bundle</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>**/*.*</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</project>