You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by zorro2b <wo...@zguy.com> on 2008/12/18 07:19:36 UTC

How to configure resources plugin to copy extra files

I am converting a project to use Maven. I have got it to compile but the
tests are failing because there are xml files in with the java source that
need to be copied over with the classes. I don't want to move these into the
resources dir, so I followed the example here:
http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html

but I get the error "'copy-resources' was specified in an execution, but not
found in the plugin"

so I have tried changing the goal to "resources" as well as removing the
goals section completely. Both get rid of the error, but no files are
copied.

Does anyone have a working config they could share?

Here is my current config:
	  <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-resources</id>
            <phase>process-resources</phase>

			<goals>
				<goal>resources</goal>
			</goals>
            <configuration>
              <outputDirectory>${basedir}/target/classes</outputDirectory>
              <resources>          
                <resource>
                  <directory>src/main/java</directory>
                  <includes>
					<include>**/*.xml</include>
				  </includes>
                </resource>
              </resources>              
            </configuration>            
          </execution>
        </executions>
      </plugin>

-- 
View this message in context: http://www.nabble.com/How-to-configure-resources-plugin-to-copy-extra-files-tp21067611p21067611.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to configure resources plugin to copy extra files

Posted by trollswagen <tr...@gmail.com>.
I had the same issue... and I didn't want to set the extra resources in the
build section of the pom, because i didn't want to include them in my jar.

I think this has to do with the version of the maven-resources-plugin that
you have installed.  If you run "maven -U" to update to the latest version
of all dependencies, it should solve the problem.  Or you can explicitly set
the version to 2.3:

            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>...</execution>
                </executions
            </plugin>


zorro2b wrote:
> 
> I am converting a project to use Maven. I have got it to compile but the
> tests are failing because there are xml files in with the java source that
> need to be copied over with the classes. I don't want to move these into
> the resources dir, so I followed the example here:
> http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html
> 
> but I get the error "'copy-resources' was specified in an execution, but
> not found in the plugin"
> 
> so I have tried changing the goal to "resources" as well as removing the
> goals section completely. Both get rid of the error, but no files are
> copied.
> 
> Does anyone have a working config they could share?
> 
> Here is my current config:
> 	  <plugin>
>         <artifactId>maven-resources-plugin</artifactId>
>         <executions>
>           <execution>
>             <id>copy-resources</id>
>             <phase>process-resources</phase>
> 
> 			<goals>
> 				<goal>resources</goal>
> 			</goals>
>             <configuration>
>               <outputDirectory>${basedir}/target/classes</outputDirectory>
>               <resources>          
>                 <resource>
>                   <directory>src/main/java</directory>
>                   <includes>
> 					<include>**/*.xml</include>
> 				  </includes>
>                 </resource>
>               </resources>              
>             </configuration>            
>           </execution>
>         </executions>
>       </plugin>
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-configure-resources-plugin-to-copy-extra-files-tp21067611p22189863.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to configure resources plugin to copy extra files

Posted by zorro2b <wo...@zguy.com>.
Excellent! That worked, thanks.


brettporter wrote:
> 
> You shouldn't need to configure the resource plugin at all, just the  
> following will work:
> 
> <resources>
>    <resource>
>      <directory>src/main/java</directory>
>      <includes>
>        <include>**/*.xml</include>
>      </includes>
>    </resource>
> </resources>
> 
> Cheers,
> Brett
> 
> On 18/12/2008, at 5:19 PM, zorro2b wrote:
> 
>>
>> I am converting a project to use Maven. I have got it to compile but  
>> the
>> tests are failing because there are xml files in with the java  
>> source that
>> need to be copied over with the classes. I don't want to move these  
>> into the
>> resources dir, so I followed the example here:
>> http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html
>>
>> but I get the error "'copy-resources' was specified in an execution,  
>> but not
>> found in the plugin"
>>
>> so I have tried changing the goal to "resources" as well as removing  
>> the
>> goals section completely. Both get rid of the error, but no files are
>> copied.
>>
>> Does anyone have a working config they could share?
>>
>> Here is my current config:
>> 	  <plugin>
>>        <artifactId>maven-resources-plugin</artifactId>
>>        <executions>
>>          <execution>
>>            <id>copy-resources</id>
>>            <phase>process-resources</phase>
>>
>> 			<goals>
>> 				<goal>resources</goal>
>> 			</goals>
>>            <configuration>
>>              <outputDirectory>${basedir}/target/classes</ 
>> outputDirectory>
>>              <resources>
>>                <resource>
>>                  <directory>src/main/java</directory>
>>                  <includes>
>> 					<include>**/*.xml</include>
>> 				  </includes>
>>                </resource>
>>              </resources>
>>            </configuration>
>>          </execution>
>>        </executions>
>>      </plugin>
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/How-to-configure-resources-plugin-to-copy-extra-files-tp21067611p21067611.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
> 
> --
> Brett Porter
> brett@apache.org
> http://blogs.exist.com/bporter/
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-configure-resources-plugin-to-copy-extra-files-tp21067611p21068948.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to configure resources plugin to copy extra files

Posted by Blueshirts <mi...@yahoo.com>.
You may not need to for his example though the example on the page sited does
not work.  Anyone know what the correct execution value should be? 
Configuring the plug-in is useful because in the example it states you can
attach it to a phase.


brettporter wrote:
> 
> You shouldn't need to configure the resource plugin at all, just the  
> following will work:
> 
> <resources>
>    <resource>
>      <directory>src/main/java</directory>
>      <includes>
>        <include>**/*.xml</include>
>      </includes>
>    </resource>
> </resources>
> 
> Cheers,
> Brett
> 
> On 18/12/2008, at 5:19 PM, zorro2b wrote:
> 
>>
>> I am converting a project to use Maven. I have got it to compile but  
>> the
>> tests are failing because there are xml files in with the java  
>> source that
>> need to be copied over with the classes. I don't want to move these  
>> into the
>> resources dir, so I followed the example here:
>> http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html
>>
>> but I get the error "'copy-resources' was specified in an execution,  
>> but not
>> found in the plugin"
>>
>> so I have tried changing the goal to "resources" as well as removing  
>> the
>> goals section completely. Both get rid of the error, but no files are
>> copied.
>>
>> Does anyone have a working config they could share?
>>
>> Here is my current config:
>> 	  <plugin>
>>        <artifactId>maven-resources-plugin</artifactId>
>>        <executions>
>>          <execution>
>>            <id>copy-resources</id>
>>            <phase>process-resources</phase>
>>
>> 			<goals>
>> 				<goal>resources</goal>
>> 			</goals>
>>            <configuration>
>>              <outputDirectory>${basedir}/target/classes</ 
>> outputDirectory>
>>              <resources>
>>                <resource>
>>                  <directory>src/main/java</directory>
>>                  <includes>
>> 					<include>**/*.xml</include>
>> 				  </includes>
>>                </resource>
>>              </resources>
>>            </configuration>
>>          </execution>
>>        </executions>
>>      </plugin>
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/How-to-configure-resources-plugin-to-copy-extra-files-tp21067611p21067611.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
> 
> --
> Brett Porter
> brett@apache.org
> http://blogs.exist.com/bporter/
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-configure-resources-plugin-to-copy-extra-files-tp21067611p22043924.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to configure resources plugin to copy extra files

Posted by Brett Porter <br...@apache.org>.
You shouldn't need to configure the resource plugin at all, just the  
following will work:

<resources>
   <resource>
     <directory>src/main/java</directory>
     <includes>
       <include>**/*.xml</include>
     </includes>
   </resource>
</resources>

Cheers,
Brett

On 18/12/2008, at 5:19 PM, zorro2b wrote:

>
> I am converting a project to use Maven. I have got it to compile but  
> the
> tests are failing because there are xml files in with the java  
> source that
> need to be copied over with the classes. I don't want to move these  
> into the
> resources dir, so I followed the example here:
> http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html
>
> but I get the error "'copy-resources' was specified in an execution,  
> but not
> found in the plugin"
>
> so I have tried changing the goal to "resources" as well as removing  
> the
> goals section completely. Both get rid of the error, but no files are
> copied.
>
> Does anyone have a working config they could share?
>
> Here is my current config:
> 	  <plugin>
>        <artifactId>maven-resources-plugin</artifactId>
>        <executions>
>          <execution>
>            <id>copy-resources</id>
>            <phase>process-resources</phase>
>
> 			<goals>
> 				<goal>resources</goal>
> 			</goals>
>            <configuration>
>              <outputDirectory>${basedir}/target/classes</ 
> outputDirectory>
>              <resources>
>                <resource>
>                  <directory>src/main/java</directory>
>                  <includes>
> 					<include>**/*.xml</include>
> 				  </includes>
>                </resource>
>              </resources>
>            </configuration>
>          </execution>
>        </executions>
>      </plugin>
>
> -- 
> View this message in context: http://www.nabble.com/How-to-configure-resources-plugin-to-copy-extra-files-tp21067611p21067611.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

--
Brett Porter
brett@apache.org
http://blogs.exist.com/bporter/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org