我知道還有很多關於這個主題的其他問題,我已經搜索並閱讀了所有內容,但即使這些問題目前還沒有幫助。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.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>
它基本上是說:拿起你的資源目錄所擁有的一切,和它確實是,所有的資源,最終在罐子的根文件。與remote-resources.xml
也放在罐子下的META-INF/manifest
目錄下。所以,一切似乎都很好,並根據預期。
現在,其他,更難,不工作的一部分。 POM文件爲模塊使用共享資源的摘錄上述
<plugin>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>process-remote-resources</id>
<goals>
<goal>process</goal>
</goals>
<configuration>
<resourceBundles>
<resourceBundle>com.myorganization:myapp-resources:1.0-SNAPSHOT</resourceBundle>
</resourceBundles>
<outputdirectory>${project.build.directory}/shared-resources</outputdirectory>
</configuration>
</execution>
</executions>
</plugin>
所以,在這裏它說指定處理來自資源包的資源,並把它們在共享資源目錄。但是,沒有任何反應。當我嘗試執行mvn remote-resources:process
時,我收到錯誤消息,說明resourceBundles
的參數丟失或無效。如果我運行mvn install
沒有錯誤,但是當我嘗試複製(maven資源插件)shared-resources
目錄中的任何內容時,它只是跳過它作爲不存在的資源目錄。
此外,我試圖把錯誤的名稱爲resourceBundle,並給我一個即時的錯誤,它不存在,所以我敢肯定,我指定了resourceBundle正確。
任何人都可以啓發我嗎?什麼做錯了?謝謝。
編輯: 添加聚甲醛的部分來引用共享資源dependecy
<dependency>
<groupId>com.myorganization</groupId>
<artifactId>myapp-resources</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
EDIT2: 添加包含共享資源罐子內遠程resources.xml中的含量:
<?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>
這個是否應該像這樣是空的(除了源編碼設置)?
EDIT3: 我已經採取了看看用於remote-resource.xml
XSD架構,似乎這不應該是空的,但是包含在這個過程中目標所使用的遠程資源的列表。這意味着這個文件不能正確生成。
EDIT4: 執行mvn remote-resources:process
當安裝拋出的錯誤:
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
什麼也很有趣,似乎在插件配置的outputDirectory
設置沒有,因爲在所有的調試回升日誌我可以看到outputDirectory
設置被設置爲默認值。
我已經列爲依賴在POM配置和沒有抱怨。那個特定的jar安裝在我的本地倉庫中。我將編輯我的原始帖子以添加該部分。 – htomek
你能否添加確切的錯誤信息?還要看看在這之前是否可以找到任何其他錯誤(也許這是後續問題)。最後,嘗試用'-X'運行Maven以獲得調試輸出。也許這將包含一些有用的信息。 –