You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ondřej Černoš <ce...@gmail.com> on 2007/05/10 16:55:56 UTC

maven-resources-plugin output directory problems

Hi all,

I am quite new to maven, so I apologize in advance if my problem is
caused by my ignorance. Actually I hope it is.

I have a small project, for evaluation and management persuade
purposes, jar packaging, consisting of some java classes and some
resources. Nothing big. I don't want the resources to be bundled in
the resulting jar, however, I would like them to be copied into the
target/ directory during the build. So I decided to configure the
maven-resources-plugin so as to use different output directory than
the default:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-resources-plugin</artifactId>
  <executions>
    <execution>
    <goals>
      <goal>resources</goal>
    </goals>
    <configuration>
      <outputDirectory>target/resources</outputDirectory>
    </configuration>
    </execution>
  </executions>
</plugin>

As i get it, during the "resources" goal on the plugin which is bound
to the process-resources phase, the outputDirectory should be
configured to target/resources.

When i run the build this way:

$ mvn -X resources:resources

I found these lines in the log:

--- sniff ---
[INFO] ----------------------------------------------------------------------------
[INFO] Building projectX
[INFO]    task-segment: [resources:resources]
[INFO] ----------------------------------------------------------------------------
--- sniff ---
[DEBUG] Configuring mojo
'org.apache.maven.plugins:maven-resources-plugin:2.2:resources' -->
[DEBUG]   (f) filters = []
[DEBUG]   (f) outputDirectory =
/home/user/projects/devel/projectX/target/classes
[DEBUG]   (f) project = org.apache.maven.project.MavenProject@f69485b
[DEBUG]   (f) resources = [org.apache.maven.model.Resource@26dbec]

and the resources end up in the target/classes directory, which is
something I do not want. However, when I run it with the phase name:

$ mvn -X process-resources
--- sniff ---
[INFO] ----------------------------------------------------------------------------
[INFO] Building projectX
[INFO]    task-segment: [process-resources]
[INFO] ----------------------------------------------------------------------------
--- sniff ---
[DEBUG] Configuring mojo
'org.apache.maven.plugins:maven-resources-plugin:2.2:resources' -->
[DEBUG]   (f) filters = []
[DEBUG]   (f) outputDirectory =
/home/user/projects/devel/projectX/target/classes
[DEBUG]   (f) project = org.apache.maven.project.MavenProject@f69485b
[DEBUG]   (f) resources = [org.apache.maven.model.Resource@ad8659]
[DEBUG] -- end configuration --
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[DEBUG] Configuring mojo
'org.apache.maven.plugins:maven-resources-plugin:2.2:resources' -->
[DEBUG]   (f) filters = []
[DEBUG]   (f) outputDirectory = target/resources
[DEBUG]   (f) project = org.apache.maven.project.MavenProject@f69485b
[DEBUG]   (f) resources = [org.apache.maven.model.Resource@ad8659]
[DEBUG] -- end configuration --

which, in the end, results in the fact the resources are copied twice,
once in the default target/classes and once in the configured
target/resources directories.

When I run mvn clean package, I end up in the same situation.

Used versions:
Maven version: 2.0.6
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03)
Linux hostname 2.6.18.8-0.3-bigsmp

Googling suggested there were some issues with copying resources in
the past (and inexistent target directories during the
process-resources phase), but it seemed to me the resulting bugfixes
were sent upstream and these issues were solved.

Thanks in advance for any kind of help.

Ondrej Cernos

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


Re: maven-resources-plugin output directory problems

Posted by Ondřej Černoš <ce...@gmail.com>.
OK, thanks, it worked. Still i don't quite get why, but it worked...

Ondrej

On 5/11/07, Maria Odea Ching <oc...@exist.com> wrote:
> You only have a configuration problem :)
>
> It should be:
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-resources-plugin</artifactId>
> <configuration>
> <outputDirectory>target/resources</outputDirectory>
> </configuration>
> </plugin>
>
> Since this goal is already bound to the "process-resources" phase, you
> need not set it in the executions tag if you're executing 'mvn
> process-resources' or 'mvn clean package' (which occurs after the
> process-resources phase in the build lifecycle).
>
> - Deng
>
>
> Ondr(ej C(ernoš wrote:
> > Hi all,
> >
> > I am quite new to maven, so I apologize in advance if my problem is
> > caused by my ignorance. Actually I hope it is.
> >
> > I have a small project, for evaluation and management persuade
> > purposes, jar packaging, consisting of some java classes and some
> > resources. Nothing big. I don't want the resources to be bundled in
> > the resulting jar, however, I would like them to be copied into the
> > target/ directory during the build. So I decided to configure the
> > maven-resources-plugin so as to use different output directory than
> > the default:
> >
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-resources-plugin</artifactId>
> > <executions>
> > <execution>
> > <goals>
> > <goal>resources</goal>
> > </goals>
> > <configuration>
> > <outputDirectory>target/resources</outputDirectory>
> > </configuration>
> > </execution>
> > </executions>
> > </plugin>
> >
> > As i get it, during the "resources" goal on the plugin which is bound
> > to the process-resources phase, the outputDirectory should be
> > configured to target/resources.
> >
> > When i run the build this way:
> >
> > $ mvn -X resources:resources
> >
> > I found these lines in the log:
> >
> > --- sniff ---
> > [INFO]
> >
> ----------------------------------------------------------------------------
> >
> > [INFO] Building projectX
> > [INFO] task-segment: [resources:resources]
> > [INFO]
> >
> ----------------------------------------------------------------------------
> >
> > --- sniff ---
> > [DEBUG] Configuring mojo
> > 'org.apache.maven.plugins:maven-resources-plugin:2.2:resources' -->
> > [DEBUG] (f) filters = []
> > [DEBUG] (f) outputDirectory =
> > /home/user/projects/devel/projectX/target/classes
> > [DEBUG] (f) project = org.apache.maven.project.MavenProject@f69485b
> > [DEBUG] (f) resources = [org.apache.maven.model.Resource@26dbec]
> >
> > and the resources end up in the target/classes directory, which is
> > something I do not want. However, when I run it with the phase name:
> >
> > $ mvn -X process-resources
> > --- sniff ---
> > [INFO]
> >
> ----------------------------------------------------------------------------
> >
> > [INFO] Building projectX
> > [INFO] task-segment: [process-resources]
> > [INFO]
> >
> ----------------------------------------------------------------------------
> >
> > --- sniff ---
> > [DEBUG] Configuring mojo
> > 'org.apache.maven.plugins:maven-resources-plugin:2.2:resources' -->
> > [DEBUG] (f) filters = []
> > [DEBUG] (f) outputDirectory =
> > /home/user/projects/devel/projectX/target/classes
> > [DEBUG] (f) project = org.apache.maven.project.MavenProject@f69485b
> > [DEBUG] (f) resources = [org.apache.maven.model.Resource@ad8659]
> > [DEBUG] -- end configuration --
> > [INFO] [resources:resources]
> > [INFO] Using default encoding to copy filtered resources.
> > [DEBUG] Configuring mojo
> > 'org.apache.maven.plugins:maven-resources-plugin:2.2:resources' -->
> > [DEBUG] (f) filters = []
> > [DEBUG] (f) outputDirectory = target/resources
> > [DEBUG] (f) project = org.apache.maven.project.MavenProject@f69485b
> > [DEBUG] (f) resources = [org.apache.maven.model.Resource@ad8659]
> > [DEBUG] -- end configuration --
> >
> > which, in the end, results in the fact the resources are copied twice,
> > once in the default target/classes and once in the configured
> > target/resources directories.
> >
> > When I run mvn clean package, I end up in the same situation.
> >
> > Used versions:
> > Maven version: 2.0.6
> > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03)
> > Linux hostname 2.6.18.8-0.3-bigsmp
> >
> > Googling suggested there were some issues with copying resources in
> > the past (and inexistent target directories during the
> > process-resources phase), but it seemed to me the resulting bugfixes
> > were sent upstream and these issues were solved.
> >
> > Thanks in advance for any kind of help.
> >
> > Ondrej Cernos
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> > !DSPAM:602,46433296209091885597236!
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: maven-resources-plugin output directory problems

Posted by Maria Odea Ching <oc...@exist.com>.
You only have a configuration problem :)

It should be:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<outputDirectory>target/resources</outputDirectory>
</configuration>
</plugin>

Since this goal is already bound to the "process-resources" phase, you 
need not set it in the executions tag if you're executing 'mvn 
process-resources' or 'mvn clean package' (which occurs after the 
process-resources phase in the build lifecycle).

- Deng


Ondr(ej C(ernoš wrote:
> Hi all,
>
> I am quite new to maven, so I apologize in advance if my problem is
> caused by my ignorance. Actually I hope it is.
>
> I have a small project, for evaluation and management persuade
> purposes, jar packaging, consisting of some java classes and some
> resources. Nothing big. I don't want the resources to be bundled in
> the resulting jar, however, I would like them to be copied into the
> target/ directory during the build. So I decided to configure the
> maven-resources-plugin so as to use different output directory than
> the default:
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-resources-plugin</artifactId>
> <executions>
> <execution>
> <goals>
> <goal>resources</goal>
> </goals>
> <configuration>
> <outputDirectory>target/resources</outputDirectory>
> </configuration>
> </execution>
> </executions>
> </plugin>
>
> As i get it, during the "resources" goal on the plugin which is bound
> to the process-resources phase, the outputDirectory should be
> configured to target/resources.
>
> When i run the build this way:
>
> $ mvn -X resources:resources
>
> I found these lines in the log:
>
> --- sniff ---
> [INFO] 
> ---------------------------------------------------------------------------- 
>
> [INFO] Building projectX
> [INFO] task-segment: [resources:resources]
> [INFO] 
> ---------------------------------------------------------------------------- 
>
> --- sniff ---
> [DEBUG] Configuring mojo
> 'org.apache.maven.plugins:maven-resources-plugin:2.2:resources' -->
> [DEBUG] (f) filters = []
> [DEBUG] (f) outputDirectory =
> /home/user/projects/devel/projectX/target/classes
> [DEBUG] (f) project = org.apache.maven.project.MavenProject@f69485b
> [DEBUG] (f) resources = [org.apache.maven.model.Resource@26dbec]
>
> and the resources end up in the target/classes directory, which is
> something I do not want. However, when I run it with the phase name:
>
> $ mvn -X process-resources
> --- sniff ---
> [INFO] 
> ---------------------------------------------------------------------------- 
>
> [INFO] Building projectX
> [INFO] task-segment: [process-resources]
> [INFO] 
> ---------------------------------------------------------------------------- 
>
> --- sniff ---
> [DEBUG] Configuring mojo
> 'org.apache.maven.plugins:maven-resources-plugin:2.2:resources' -->
> [DEBUG] (f) filters = []
> [DEBUG] (f) outputDirectory =
> /home/user/projects/devel/projectX/target/classes
> [DEBUG] (f) project = org.apache.maven.project.MavenProject@f69485b
> [DEBUG] (f) resources = [org.apache.maven.model.Resource@ad8659]
> [DEBUG] -- end configuration --
> [INFO] [resources:resources]
> [INFO] Using default encoding to copy filtered resources.
> [DEBUG] Configuring mojo
> 'org.apache.maven.plugins:maven-resources-plugin:2.2:resources' -->
> [DEBUG] (f) filters = []
> [DEBUG] (f) outputDirectory = target/resources
> [DEBUG] (f) project = org.apache.maven.project.MavenProject@f69485b
> [DEBUG] (f) resources = [org.apache.maven.model.Resource@ad8659]
> [DEBUG] -- end configuration --
>
> which, in the end, results in the fact the resources are copied twice,
> once in the default target/classes and once in the configured
> target/resources directories.
>
> When I run mvn clean package, I end up in the same situation.
>
> Used versions:
> Maven version: 2.0.6
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03)
> Linux hostname 2.6.18.8-0.3-bigsmp
>
> Googling suggested there were some issues with copying resources in
> the past (and inexistent target directories during the
> process-resources phase), but it seemed to me the resulting bugfixes
> were sent upstream and these issues were solved.
>
> Thanks in advance for any kind of help.
>
> Ondrej Cernos
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> !DSPAM:602,46433296209091885597236!
>


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