views:

824

answers:

4

As part of my pom.xml I copy some extra resources to the target directory as follows.

 <plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-resources-plugin</artifactId>
  <version>2.4.1</version>
  <executions>
   <execution>
 <id>copy-package-doc</id>
 <phase>package</phase>
 <goals>
  <goal>copy-resources</goal>
 </goals>
 <configuration>
  <outputDirectory>${project.build.directory}/package/${project.artifactId}-${project.version}/doc</outputDirectory>
  <nonFilteredFileExtensions>
   <nonFilteredFileExtension>doc</nonFilteredFileExtension>
  </nonFilteredFileExtensions>
  <resources>
   <resource>
    <directory>doc</directory>
    <filtering>true</filtering>
    <includes>
  <include>**/*.doc</include>
    </includes>
    <excludes>
  <exclude>**/~*.doc</exclude>
    </excludes>
   </resource>
  </resources>
 </configuration>
   </execution>
   <execution>
 <id>copy-package-config</id>
 <phase>package</phase>
 <goals>
  <goal>copy-resources</goal>
 </goals>
 <configuration>
  <outputDirectory>${project.build.directory}/package/${project.artifactId}-${project.version}</outputDirectory>
  <resources>
   <resource>
    <directory>config</directory>
    <filtering>true</filtering>
   </resource>
  </resources>
 </configuration>
   </execution>
  </executions>
 </plugin>

When I package artifact I get error:

The PluginDescriptor for the plugin org.apache.maven.plugins:maven-resources-plugin was not found. Should have been in realm: ClassRealm[/plugins/org.apache.maven.plugins:maven-resources-plugin:2.4.1@48/thread:Worker-17, parent: null]

How to fix that? Why I get this error?

Thanks, Rafal

A: 

Include info on version used for: eclipse, java, maven

Try running mvn package -U -e and include output on pastebin.

Also try using another version of resources-plugin <version>2.3</version> or why do you need 2.4.1


Sounds like you got a corrupted maven plugin

Try deleting the folder maven-resources-plugin contained in .m2/repository/org/apache/maven

Or post (or include link to) whole error message

jitter
Switch to version 2.3 is not valid solution in my case. I had tried this before I posted question to StackOverflow. I cannot check "mvn package -U -e" because problem do not exist since I have moved to M2Eclipse.
Rafal
A: 

I have deleted .m2\repository\org\apache\maven\plugins\maven-resources-plugin but this haven't help.

I am using Q for Eclipse plugin. When I execute package artifact I get following output:

13:54:05 CET Starting Starting mavenExecution E:\projects\src-java\myproject
13:54:05 CET Starting Starting reactorExecution E:\projects\src-java\myproject
13:54:05 CET info Scanning for projects... 
13:54:05 CET Starting Starting projectExecution myproject
Id: erchu:erchu.myproject:jar:1.0
task-segment: [package]
13:54:09 CET info Attempting to resolve a version for plugin: org.bluestemsoftware.open.maven.plugin:launch4j-plugin using meta-version: LATEST 
13:54:09 CET info Using version: 1.0.0.3 of plugin: org.bluestemsoftware.open.maven.plugin:launch4j-plugin 
13:54:10 CET Starting Starting phaseExecution process-resources
13:54:10 CET Starting Starting mojoExecution resources:resources
13:54:10 CET warn Using platform encoding (Cp1250 actually) to copy filtered resources, i.e. build is platform dependent! 
13:54:10 CET info Copying 4 resources 
13:54:10 CET Finished Finished mojoExecution resources:resources
13:54:10 CET Finished Finished phaseExecution process-resources
13:54:10 CET Starting Starting phaseExecution compile
13:54:11 CET Starting Starting mojoExecution compiler:compile
13:54:11 CET info Nothing to compile - all classes are up to date 
13:54:11 CET Finished Finished mojoExecution compiler:compile
13:54:11 CET Finished Finished phaseExecution compile
13:54:11 CET Starting Starting phaseExecution process-test-resources
13:54:11 CET Starting Starting mojoExecution resources:testResources
13:54:11 CET warn Using platform encoding (Cp1250 actually) to copy filtered resources, i.e. build is platform dependent! 
13:54:11 CET info Copying 3 resources 
13:54:11 CET Finished Finished mojoExecution resources:testResources
13:54:11 CET Finished Finished phaseExecution process-test-resources
13:54:11 CET Starting Starting phaseExecution test-compile
13:54:11 CET Starting Starting mojoExecution compiler:testCompile
13:54:11 CET info Nothing to compile - all classes are up to date 
13:54:11 CET Finished Finished mojoExecution compiler:testCompile
13:54:11 CET Finished Finished phaseExecution test-compile
13:54:11 CET Starting Starting phaseExecution test
13:54:11 CET Starting Starting mojoExecution surefire:test
13:54:11 CET info Tests are skipped. 
13:54:11 CET Finished Finished mojoExecution surefire:test
13:54:11 CET Finished Finished phaseExecution test
13:54:11 CET Starting Starting phaseExecution package
13:54:11 CET Starting Starting mojoExecution jar:jar
13:54:11 CET info Building jar: E:\projects\src-java\myproject\target\package\erchu.myproject-1.0\lib\erchu.myproject-1.0.jar 
13:54:11 CET Finished Finished mojoExecution jar:jar
13:54:11 CET Starting Starting mojoExecution dependency:copy-dependencies
13:54:11 CET info antlr-2.7.6.jar already exists in destination. 
13:54:11 CET info aopalliance-1.0.jar already exists in destination. 
13:54:11 CET info asm-3.1.jar already exists in destination. 
13:54:11 CET info cglib-2.2.jar already exists in destination. 
13:54:11 CET info commons-collections-3.1.jar already exists in destination. 
13:54:11 CET info commons-logging-1.1.1.jar already exists in destination. 
13:54:11 CET info dom4j-1.6.1.jar already exists in destination. 
13:54:11 CET info htmlcleaner-2.1.jar already exists in destination. 
13:54:11 CET info javassist-3.8.0.GA.jar already exists in destination. 
13:54:11 CET info jta-1.1.jar already exists in destination. 
13:54:11 CET info junit-4.4.jar already exists in destination. 
13:54:11 CET info log4j-1.2.14.jar already exists in destination. 
13:54:11 CET info jtds-1.2.2.jar already exists in destination. 
13:54:11 CET info commons-io-1.3.2.jar already exists in destination. 
13:54:11 CET info commons-dbcp-all-1.3.jar already exists in destination. 
13:54:11 CET info easymock-2.4.jar already exists in destination. 
13:54:11 CET info ejb3-persistence-1.0.2.GA.jar already exists in destination. 
13:54:11 CET info hibernate-annotations-3.4.0.GA.jar already exists in destination. 
13:54:11 CET info hibernate-commons-annotations-3.1.0.GA.jar already exists in destination. 
13:54:11 CET info hibernate-core-3.3.0.SP1.jar already exists in destination. 
13:54:11 CET info hibernate-jmx-3.3.2.GA.jar already exists in destination. 
13:54:11 CET info slf4j-api-1.5.6.jar already exists in destination. 
13:54:11 CET info slf4j-log4j12-1.5.6.jar already exists in destination. 
13:54:11 CET info spring-aop-2.5.6.jar already exists in destination. 
13:54:11 CET info spring-beans-2.5.6.jar already exists in destination. 
13:54:11 CET info spring-context-2.5.6.jar already exists in destination. 
13:54:11 CET info spring-core-2.5.6.jar already exists in destination. 
13:54:11 CET info spring-jdbc-2.5.6.jar already exists in destination. 
13:54:11 CET info spring-orm-2.5.6.jar already exists in destination. 
13:54:11 CET info spring-test-2.5.6.jar already exists in destination. 
13:54:11 CET info spring-tx-2.5.6.jar already exists in destination. 
13:54:11 CET info xml-apis-1.0.b2.jar already exists in destination. 
13:54:11 CET Finished Finished mojoExecution dependency:copy-dependencies
13:54:12 CET Starting Starting mojoExecution launch4j:launch4j
13:54:12 CET info Platform-specific work directory already exists: C:\Documents and Settings\rach\.m2\repository\org\bluestemsoftware\open\maven\plugin\launch4j-plugin\1.0.0.3 
13:54:12 CET info launch4j: Compiling resources 
13:54:12 CET info launch4j: Linking 
13:54:12 CET info launch4j: Successfully created E:\projects\src-java\myproject\target\package\erchu.myproject-1.0\myproject.exe 
13:54:12 CET Finished Finished mojoExecution launch4j:launch4j
13:54:12 CET Starting Starting mojoExecution resources:copy-resources
13:54:12 CET warn File encoding has not been set, using platform encoding Cp1250, i.e. build is platform dependent! 
13:54:12 CET warn Using platform encoding (Cp1250 actually) to copy filtered resources, i.e. build is platform dependent! 
13:54:12 CET info Copying 2 resources 
13:54:12 CET Finished Finished mojoExecution resources:copy-resources
13:54:12 CET Starting Starting mojoExecution resources:copy-resources
13:54:12 CET warn File encoding has not been set, using platform encoding Cp1250, i.e. build is platform dependent! 
13:54:12 CET warn Using platform encoding (Cp1250 actually) to copy filtered resources, i.e. build is platform dependent! 
13:54:12 CET info Copying 1 resource 
13:54:12 CET Finished Finished mojoExecution resources:copy-resources
13:54:12 CET Starting Starting mojoExecution assembly:single
13:54:12 CET info Reading assembly descriptor: E:\projects\src-java\myproject\assembly.xml 
13:54:12 CET info Building zip: E:\projects\src-java\myproject\dist\erchu.myproject-1.0-dist.zip 
13:54:14 CET Finished Finished mojoExecution assembly:single
13:54:14 CET Finished Finished phaseExecution package
13:54:14 CET Finished Finished projectExecution myproject
Id: erchu:erchu.myproject:jar:1.0
task-segment: [package]
13:54:14 CET Finished Finished mavenExecution E:\projects\src-java\myproject
13:54:14 CET Finished Finished reactorExecution E:\projects\src-java\myproject

Whole error message from "Problems" view in Eclipse:

Description Resource Path Location Type
The PluginDescriptor for the plugin org.apache.maven.plugins:maven-resources-plugin was not found. Should have been in realm: ClassRealm[/plugins/org.apache.maven.plugins:maven-resources-plugin:2.4.1@48/thread:Worker-4, parent: null] pom.xml /myproject line 1 pomproblemmarker
Rafal
Expanded my answer
jitter
Please don't post this as an answer (this isn't an answer). Instead, edit you initial question and add the details to it. Thanks.
Pascal Thivent
A: 

I've seen lots of similar issues on the web (e.g. in IDEA-16866, IDEADEV-24376, MIDEA-109 or this one about Eclipse/IAM which seems to be the closest). In all cases, this seems related to Maven Embedder.

I have actually no idea of the cause of the problem and have no better suggestion than to use the latest version of maven (2.2.1) if it's not the case and/or to try with previous versions of the maven-resources-plugin (2.3) to verify that this is not a regression.

If this doesn't work, go the Maven 2.x Resources Plugin Jira and open an issue.

Pascal Thivent
A: 

I have switched from Q for Eclipse to M2Eclipse and this solved my problem.

Rafal