M2 project descriptor resource element

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

M2 project descriptor resource element

Hugo Palma
I'm trying to reference a resource like i did in Maven 1 using the
resource element like this:

<resource>
    <directory>src/test/otherResources</directory>
        <includes>
                        <include>*.xml</include>
       </includes>
</resource>

But it seems that in Maven 2 the only child element <resource> accepts
is the <targetPath> element.
What about the source path ? What about the includes and excludes ? I've
tried doing that Maven 1 way but i get an error from the pom parser.


Thanks

Hugo

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: M2 project descriptor resource element

Brett Porter
On 5/6/05, Hugo Palma <[hidden email]> wrote:
> I'm trying to reference a resource like i did in Maven 1 using the
> resource element like this:
>
> <resource>
>     <directory>src/test/otherResources</directory>
>         <includes>
>                         <include>*.xml</include>
>        </includes>
> </resource>

nested inside <resources /> inside <build/> this should work.

> But it seems that in Maven 2 the only child element <resource> accepts
> is the <targetPath> element.

Where did you get that information from... is there an error in the
docs? targetPath is the only one not allowed in m2 :)

Cheers,
Brett

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: M2 project descriptor resource element

Kenney Westerhof
On Fri, 6 May 2005, Brett Porter wrote:

> On 5/6/05, Hugo Palma <[hidden email]> wrote:
> > I'm trying to reference a resource like i did in Maven 1 using the
> > resource element like this:
> >
> > <resource>
> >     <directory>src/test/otherResources</directory>
> >         <includes>
> >                         <include>*.xml</include>
> >        </includes>
> > </resource>
>
> nested inside <resources /> inside <build/> this should work.
>
> > But it seems that in Maven 2 the only child element <resource> accepts
> > is the <targetPath> element.
>
> Where did you get that information from... is there an error in the
> docs? targetPath is the only one not allowed in m2 :)

Not according to Resource.java in maven-model :)

In addition to Brett, here's some more information, extracted from the
sources:

Resource (<resource/>) has an optional child <targetPath/> element;
Resource extends FileSet which adds the <directory/> element;
FileSet extends PatternSet which adds <includes/> and <excludes/> tags;

The includes and excludes are both List's, and are built by nested
<include/> and <exclude/> tags respectively. Pretty much maven1 style.

so the complete set will be:

<project>
  ...
  <build>
  ...
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <targetPath>whatever/</targetPath>
        <includes>
          <include>*.xcfg</include>
        </includes>
        <excludes>
          <exclude>*.example</exclude>
        </excludes>
      </resource>
    </resources>
  ...
  </build>
  ...
</project>

This is not clear in
http://maven.apache.org/maven2/project-descriptor.html (could use some
indenting and '/' in the ending tags for clarity, there).


--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: M2 project descriptor resource element

Hugo Palma
Still can't make it work.
I didn't mention in the first post but i'm using the <testResources>
element as parent to resource.
So my pom looks like:

....
<build>
        <testResources>
            <resources>
                <resource>
                    <directory>src/sql</directory>
                    <targetPath>${maven.build.dest}</targetPath>
                </resource>
            </resources>
        </testResources>
</build>

and i've tried:
......
<build>
        <testResources>
                <resource>
                    <directory>src/sql</directory>
                    <targetPath>${maven.build.dest}</targetPath>
                </resource>
        </testResources>
</build>



with no success. The error i get is:

org.apache.maven.reactor.ReactorException: Error processing projects for
the rea
ctor:
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:117)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:233)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:303)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:243)
        at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:416)

        at org.codehaus.classworlds.Launcher.main(Launcher.java:363)
Caused by: org.apache.maven.project.ProjectBuildingException: Error
while readin
g model from file 'C:\java\projectos\Digitalis\pom.xml'.
        at
org.apache.maven.project.DefaultMavenProjectBuilder.readModel(Default
MavenProjectBuilder.java:470)
        at
org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFi
le(DefaultMavenProjectBuilder.java:124)
        at
org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMave
nProjectBuilder.java:117)
        at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:266)
        at
org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:170)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:102)
        ... 9 more
Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException:
TEXT must b
e immediately followed by END_TAG and not START_TAG (position: START_TAG
seen ..
.<resources>\r\n\t\t\t\t<resource>... @144:15)
        at
org.codehaus.plexus.util.xml.pull.MXParser.nextText(MXParser.java:105
9)
        at
org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseBuild(MavenXpp3Re
ader.java:133)
        at
org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseModel(MavenXpp3Re
ader.java:886)
        at
org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.j
ava:1660)
        at
org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:461)



Thanks for the help

Hugo



Kenney Westerhof wrote:

>On Fri, 6 May 2005, Brett Porter wrote:
>
>  
>
>>On 5/6/05, Hugo Palma <[hidden email]> wrote:
>>    
>>
>>>I'm trying to reference a resource like i did in Maven 1 using the
>>>resource element like this:
>>>
>>><resource>
>>>    <directory>src/test/otherResources</directory>
>>>        <includes>
>>>                        <include>*.xml</include>
>>>       </includes>
>>></resource>
>>>      
>>>
>>nested inside <resources /> inside <build/> this should work.
>>
>>    
>>
>>>But it seems that in Maven 2 the only child element <resource> accepts
>>>is the <targetPath> element.
>>>      
>>>
>>Where did you get that information from... is there an error in the
>>docs? targetPath is the only one not allowed in m2 :)
>>    
>>
>
>Not according to Resource.java in maven-model :)
>
>In addition to Brett, here's some more information, extracted from the
>sources:
>
>Resource (<resource/>) has an optional child <targetPath/> element;
>Resource extends FileSet which adds the <directory/> element;
>FileSet extends PatternSet which adds <includes/> and <excludes/> tags;
>
>The includes and excludes are both List's, and are built by nested
><include/> and <exclude/> tags respectively. Pretty much maven1 style.
>
>so the complete set will be:
>
><project>
>  ...
>  <build>
>  ...
>    <resources>
>      <resource>
>        <directory>src/main/resources</directory>
> <targetPath>whatever/</targetPath>
> <includes>
>  <include>*.xcfg</include>
> </includes>
> <excludes>
>  <exclude>*.example</exclude>
> </excludes>
>      </resource>
>    </resources>
>  ...
>  </build>
>  ...
></project>
>
>This is not clear in
>http://maven.apache.org/maven2/project-descriptor.html (could use some
>indenting and '/' in the ending tags for clarity, there).
>
>
>--
>Kenney Westerhof
>http://www.neonics.com
>GPG public key: http://www.gods.nl/~forge/kenneyw.key
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]
>
>
>  
>
Reply | Threaded
Open this post in threaded view
|

Re: M2 project descriptor resource element

Kenney Westerhof
On Fri, 6 May 2005, Hugo Palma wrote:

> Still can't make it work.
> I didn't mention in the first post but i'm using the <testResources>
> element as parent to resource.
> So my pom looks like:
>
> ....
> <build>
>         <testResources>
>             <resources>
>                 <resource>
>                     <directory>src/sql</directory>
>                     <targetPath>${maven.build.dest}</targetPath>
>                 </resource>
>             </resources>
>         </testResources>
> </build>

That's the wrong one..

>
> and i've tried:
> ......
> <build>
>         <testResources>
>                 <resource>
>                     <directory>src/sql</directory>
>                     <targetPath>${maven.build.dest}</targetPath>
>                 </resource>
>         </testResources>
> </build>

This seems correct. The stacktrace below however is for the first
configuration. What error do you get when you use the latter
configuration?


-- Kenney

>
>
> with no success. The error i get is:
>
> org.apache.maven.reactor.ReactorException: Error processing projects for
> the rea
> ctor:
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:117)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:233)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at
> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:303)
>         at org.codehaus.classworlds.Launcher.launch(Launcher.java:243)
>         at
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:416)
>
>         at org.codehaus.classworlds.Launcher.main(Launcher.java:363)
> Caused by: org.apache.maven.project.ProjectBuildingException: Error
> while readin
> g model from file 'C:\java\projectos\Digitalis\pom.xml'.
>         at
> org.apache.maven.project.DefaultMavenProjectBuilder.readModel(Default
> MavenProjectBuilder.java:470)
>         at
> org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFi
> le(DefaultMavenProjectBuilder.java:124)
>         at
> org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMave
> nProjectBuilder.java:117)
>         at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:266)
>         at
> org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:170)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:102)
>         ... 9 more
> Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException:
> TEXT must b
> e immediately followed by END_TAG and not START_TAG (position: START_TAG
> seen ..
> .<resources>\r\n\t\t\t\t<resource>... @144:15)
>         at
> org.codehaus.plexus.util.xml.pull.MXParser.nextText(MXParser.java:105
> 9)
>         at
> org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseBuild(MavenXpp3Re
> ader.java:133)
>         at
> org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseModel(MavenXpp3Re
> ader.java:886)
>         at
> org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.j
> ava:1660)
>         at
> org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:461)
>
>
>
> Thanks for the help
>
> Hugo
>
>
>
> Kenney Westerhof wrote:
>
> >On Fri, 6 May 2005, Brett Porter wrote:
> >
> >
> >
> >>On 5/6/05, Hugo Palma <[hidden email]> wrote:
> >>
> >>
> >>>I'm trying to reference a resource like i did in Maven 1 using the
> >>>resource element like this:
> >>>
> >>><resource>
> >>>    <directory>src/test/otherResources</directory>
> >>>        <includes>
> >>>                        <include>*.xml</include>
> >>>       </includes>
> >>></resource>
> >>>
> >>>
> >>nested inside <resources /> inside <build/> this should work.
> >>
> >>
> >>
> >>>But it seems that in Maven 2 the only child element <resource> accepts
> >>>is the <targetPath> element.
> >>>
> >>>
> >>Where did you get that information from... is there an error in the
> >>docs? targetPath is the only one not allowed in m2 :)
> >>
> >>
> >
> >Not according to Resource.java in maven-model :)
> >
> >In addition to Brett, here's some more information, extracted from the
> >sources:
> >
> >Resource (<resource/>) has an optional child <targetPath/> element;
> >Resource extends FileSet which adds the <directory/> element;
> >FileSet extends PatternSet which adds <includes/> and <excludes/> tags;
> >
> >The includes and excludes are both List's, and are built by nested
> ><include/> and <exclude/> tags respectively. Pretty much maven1 style.
> >
> >so the complete set will be:
> >
> ><project>
> >  ...
> >  <build>
> >  ...
> >    <resources>
> >      <resource>
> >        <directory>src/main/resources</directory>
> > <targetPath>whatever/</targetPath>
> > <includes>
> >  <include>*.xcfg</include>
> > </includes>
> > <excludes>
> >  <exclude>*.example</exclude>
> > </excludes>
> >      </resource>
> >    </resources>
> >  ...
> >  </build>
> >  ...
> ></project>
> >
> >This is not clear in
> >http://maven.apache.org/maven2/project-descriptor.html (could use some
> >indenting and '/' in the ending tags for clarity, there).
> >
> >
> >--
> >Kenney Westerhof
> >http://www.neonics.com
> >GPG public key: http://www.gods.nl/~forge/kenneyw.key
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [hidden email]
> >For additional commands, e-mail: [hidden email]
> >
> >
> >
> >
>

--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: M2 project descriptor resource element

Emmanuel Venisse-2
In reply to this post by Hugo Palma
The child of <testResources> is <testResource> and not <resource>

Emmanuel

----- Original Message -----
From: "Hugo Palma" <[hidden email]>
To: "Maven Users List" <[hidden email]>
Sent: Friday, May 06, 2005 3:08 PM
Subject: Re: M2 project descriptor resource element


> Still can't make it work.
> I didn't mention in the first post but i'm using the <testResources>
> element as parent to resource.
> So my pom looks like:
>
> ....
> <build>
>         <testResources>
>             <resources>
>                 <resource>
>                     <directory>src/sql</directory>
>                     <targetPath>${maven.build.dest}</targetPath>
>                 </resource>
>             </resources>
>         </testResources>
> </build>
>
> and i've tried:
> ......
> <build>
>         <testResources>
>                 <resource>
>                     <directory>src/sql</directory>
>                     <targetPath>${maven.build.dest}</targetPath>
>                 </resource>
>         </testResources>
> </build>
>
>
>
> with no success. The error i get is:
>
> org.apache.maven.reactor.ReactorException: Error processing projects for
> the rea
> ctor:
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:117)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:233)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at
> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:303)
>         at org.codehaus.classworlds.Launcher.launch(Launcher.java:243)
>         at
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:416)
>
>         at org.codehaus.classworlds.Launcher.main(Launcher.java:363)
> Caused by: org.apache.maven.project.ProjectBuildingException: Error
> while readin
> g model from file 'C:\java\projectos\Digitalis\pom.xml'.
>         at
> org.apache.maven.project.DefaultMavenProjectBuilder.readModel(Default
> MavenProjectBuilder.java:470)
>         at
> org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFi
> le(DefaultMavenProjectBuilder.java:124)
>         at
> org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMave
> nProjectBuilder.java:117)
>         at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:266)
>         at
> org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:170)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:102)
>         ... 9 more
> Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException:
> TEXT must b
> e immediately followed by END_TAG and not START_TAG (position: START_TAG
> seen ..
> .<resources>\r\n\t\t\t\t<resource>... @144:15)
>         at
> org.codehaus.plexus.util.xml.pull.MXParser.nextText(MXParser.java:105
> 9)
>         at
> org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseBuild(MavenXpp3Re
> ader.java:133)
>         at
> org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseModel(MavenXpp3Re
> ader.java:886)
>         at
> org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.j
> ava:1660)
>         at
>
org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenPr
ojectBuilder.java:461)

>
>
>
> Thanks for the help
>
> Hugo
>
>
>
> Kenney Westerhof wrote:
>
> >On Fri, 6 May 2005, Brett Porter wrote:
> >
> >
> >
> >>On 5/6/05, Hugo Palma <[hidden email]> wrote:
> >>
> >>
> >>>I'm trying to reference a resource like i did in Maven 1 using the
> >>>resource element like this:
> >>>
> >>><resource>
> >>>    <directory>src/test/otherResources</directory>
> >>>        <includes>
> >>>                        <include>*.xml</include>
> >>>       </includes>
> >>></resource>
> >>>
> >>>
> >>nested inside <resources /> inside <build/> this should work.
> >>
> >>
> >>
> >>>But it seems that in Maven 2 the only child element <resource> accepts
> >>>is the <targetPath> element.
> >>>
> >>>
> >>Where did you get that information from... is there an error in the
> >>docs? targetPath is the only one not allowed in m2 :)
> >>
> >>
> >
> >Not according to Resource.java in maven-model :)
> >
> >In addition to Brett, here's some more information, extracted from the
> >sources:
> >
> >Resource (<resource/>) has an optional child <targetPath/> element;
> >Resource extends FileSet which adds the <directory/> element;
> >FileSet extends PatternSet which adds <includes/> and <excludes/> tags;
> >
> >The includes and excludes are both List's, and are built by nested
> ><include/> and <exclude/> tags respectively. Pretty much maven1 style.
> >
> >so the complete set will be:
> >
> ><project>
> >  ...
> >  <build>
> >  ...
> >    <resources>
> >      <resource>
> >        <directory>src/main/resources</directory>
> > <targetPath>whatever/</targetPath>
> > <includes>
> >   <include>*.xcfg</include>
> > </includes>
> > <excludes>
> >   <exclude>*.example</exclude>
> > </excludes>
> >      </resource>
> >    </resources>
> >  ...
> >  </build>
> >  ...
> ></project>
> >
> >This is not clear in
> >http://maven.apache.org/maven2/project-descriptor.html (could use some
> >indenting and '/' in the ending tags for clarity, there).
> >
> >
> >--
> >Kenney Westerhof
> >http://www.neonics.com
> >GPG public key: http://www.gods.nl/~forge/kenneyw.key
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [hidden email]
> >For additional commands, e-mail: [hidden email]
> >
> >
> >
> >
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: M2 project descriptor resource element

Brett Porter
In reply to this post by Hugo Palma
The second one is closer. It should actually be
<testResources><testResource>...</testResource></testResources>

Sorry for the bad doco - I will get it polished up shortly.

<targetPath/> is relative, so what you have here is not appropriate,
and is not needed regardless (the base it is copied to is the
destination directory).

Cheers,
Brett

On 5/6/05, Hugo Palma <[hidden email]> wrote:

> Still can't make it work.
> I didn't mention in the first post but i'm using the <testResources>
> element as parent to resource.
> So my pom looks like:
>
> ....
> <build>
>         <testResources>
>             <resources>
>                 <resource>
>                     <directory>src/sql</directory>
>                     <targetPath>${maven.build.dest}</targetPath>
>                 </resource>
>             </resources>
>         </testResources>
> </build>
>
> and i've tried:
> ......
> <build>
>         <testResources>
>                 <resource>
>                     <directory>src/sql</directory>
>                     <targetPath>${maven.build.dest}</targetPath>
>                 </resource>
>         </testResources>
> </build>
>
> with no success. The error i get is:
>
> org.apache.maven.reactor.ReactorException: Error processing projects for
> the rea
> ctor:
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:117)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:233)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at
> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:303)
>         at org.codehaus.classworlds.Launcher.launch(Launcher.java:243)
>         at
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:416)
>
>         at org.codehaus.classworlds.Launcher.main(Launcher.java:363)
> Caused by: org.apache.maven.project.ProjectBuildingException: Error
> while readin
> g model from file 'C:\java\projectos\Digitalis\pom.xml'.
>         at
> org.apache.maven.project.DefaultMavenProjectBuilder.readModel(Default
> MavenProjectBuilder.java:470)
>         at
> org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFi
> le(DefaultMavenProjectBuilder.java:124)
>         at
> org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMave
> nProjectBuilder.java:117)
>         at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:266)
>         at
> org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:170)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:102)
>         ... 9 more
> Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException:
> TEXT must b
> e immediately followed by END_TAG and not START_TAG (position: START_TAG
> seen ..
> .<resources>\r\n\t\t\t\t<resource>... @144:15)
>         at
> org.codehaus.plexus.util.xml.pull.MXParser.nextText(MXParser.java:105
> 9)
>         at
> org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseBuild(MavenXpp3Re
> ader.java:133)
>         at
> org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseModel(MavenXpp3Re
> ader.java:886)
>         at
> org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.j
> ava:1660)
>         at
> org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:461)
>
> Thanks for the help
>
> Hugo
>
>
> Kenney Westerhof wrote:
>
> >On Fri, 6 May 2005, Brett Porter wrote:
> >
> >
> >
> >>On 5/6/05, Hugo Palma <[hidden email]> wrote:
> >>
> >>
> >>>I'm trying to reference a resource like i did in Maven 1 using the
> >>>resource element like this:
> >>>
> >>><resource>
> >>>    <directory>src/test/otherResources</directory>
> >>>        <includes>
> >>>                        <include>*.xml</include>
> >>>       </includes>
> >>></resource>
> >>>
> >>>
> >>nested inside <resources /> inside <build/> this should work.
> >>
> >>
> >>
> >>>But it seems that in Maven 2 the only child element <resource> accepts
> >>>is the <targetPath> element.
> >>>
> >>>
> >>Where did you get that information from... is there an error in the
> >>docs? targetPath is the only one not allowed in m2 :)
> >>
> >>
> >
> >Not according to Resource.java in maven-model :)
> >
> >In addition to Brett, here's some more information, extracted from the
> >sources:
> >
> >Resource (<resource/>) has an optional child <targetPath/> element;
> >Resource extends FileSet which adds the <directory/> element;
> >FileSet extends PatternSet which adds <includes/> and <excludes/> tags;
> >
> >The includes and excludes are both List's, and are built by nested
> ><include/> and <exclude/> tags respectively. Pretty much maven1 style.
> >
> >so the complete set will be:
> >
> ><project>
> >  ...
> >  <build>
> >  ...
> >    <resources>
> >      <resource>
> >        <directory>src/main/resources</directory>
> >       <targetPath>whatever/</targetPath>
> >       <includes>
> >         <include>*.xcfg</include>
> >       </includes>
> >       <excludes>
> >         <exclude>*.example</exclude>
> >       </excludes>
> >      </resource>
> >    </resources>
> >  ...
> >  </build>
> >  ...
> ></project>
> >
> >This is not clear in
> >http://maven.apache.org/maven2/project-descriptor.html (could use some
> >indenting and '/' in the ending tags for clarity, there).
> >
> >
> >--
> >Kenney Westerhof
> >http://www.neonics.com
> >GPG public key: http://www.gods.nl/~forge/kenneyw.key
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [hidden email]
> >For additional commands, e-mail: [hidden email]
> >
> >
> >
> >
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: M2 project descriptor resource element

Hugo Palma
It works now.
Thanks for the help.


Hugo



Brett Porter wrote:

>The second one is closer. It should actually be
><testResources><testResource>...</testResource></testResources>
>
>Sorry for the bad doco - I will get it polished up shortly.
>
><targetPath/> is relative, so what you have here is not appropriate,
>and is not needed regardless (the base it is copied to is the
>destination directory).
>
>Cheers,
>Brett
>
>On 5/6/05, Hugo Palma <[hidden email]> wrote:
>  
>
>>Still can't make it work.
>>I didn't mention in the first post but i'm using the <testResources>
>>element as parent to resource.
>>So my pom looks like:
>>
>>....
>><build>
>>        <testResources>
>>            <resources>
>>                <resource>
>>                    <directory>src/sql</directory>
>>                    <targetPath>${maven.build.dest}</targetPath>
>>                </resource>
>>            </resources>
>>        </testResources>
>></build>
>>
>>and i've tried:
>>......
>><build>
>>        <testResources>
>>                <resource>
>>                    <directory>src/sql</directory>
>>                    <targetPath>${maven.build.dest}</targetPath>
>>                </resource>
>>        </testResources>
>></build>
>>
>>with no success. The error i get is:
>>
>>org.apache.maven.reactor.ReactorException: Error processing projects for
>>the rea
>>ctor:
>>        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:117)
>>        at org.apache.maven.cli.MavenCli.main(MavenCli.java:233)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
>>java:39)
>>        at
>>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
>>sorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:324)
>>        at
>>org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:303)
>>        at org.codehaus.classworlds.Launcher.launch(Launcher.java:243)
>>        at
>>org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:416)
>>
>>        at org.codehaus.classworlds.Launcher.main(Launcher.java:363)
>>Caused by: org.apache.maven.project.ProjectBuildingException: Error
>>while readin
>>g model from file 'C:\java\projectos\Digitalis\pom.xml'.
>>        at
>>org.apache.maven.project.DefaultMavenProjectBuilder.readModel(Default
>>MavenProjectBuilder.java:470)
>>        at
>>org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFi
>>le(DefaultMavenProjectBuilder.java:124)
>>        at
>>org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMave
>>nProjectBuilder.java:117)
>>        at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:266)
>>        at
>>org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:170)
>>        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:102)
>>        ... 9 more
>>Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException:
>>TEXT must b
>>e immediately followed by END_TAG and not START_TAG (position: START_TAG
>>seen ..
>>.<resources>\r\n\t\t\t\t<resource>... @144:15)
>>        at
>>org.codehaus.plexus.util.xml.pull.MXParser.nextText(MXParser.java:105
>>9)
>>        at
>>org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseBuild(MavenXpp3Re
>>ader.java:133)
>>        at
>>org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseModel(MavenXpp3Re
>>ader.java:886)
>>        at
>>org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.j
>>ava:1660)
>>        at
>>org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:461)
>>
>>Thanks for the help
>>
>>Hugo
>>
>>
>>Kenney Westerhof wrote:
>>
>>    
>>
>>>On Fri, 6 May 2005, Brett Porter wrote:
>>>
>>>
>>>
>>>      
>>>
>>>>On 5/6/05, Hugo Palma <[hidden email]> wrote:
>>>>
>>>>
>>>>        
>>>>
>>>>>I'm trying to reference a resource like i did in Maven 1 using the
>>>>>resource element like this:
>>>>>
>>>>><resource>
>>>>>   <directory>src/test/otherResources</directory>
>>>>>       <includes>
>>>>>                       <include>*.xml</include>
>>>>>      </includes>
>>>>></resource>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>nested inside <resources /> inside <build/> this should work.
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>>>But it seems that in Maven 2 the only child element <resource> accepts
>>>>>is the <targetPath> element.
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>Where did you get that information from... is there an error in the
>>>>docs? targetPath is the only one not allowed in m2 :)
>>>>
>>>>
>>>>        
>>>>
>>>Not according to Resource.java in maven-model :)
>>>
>>>In addition to Brett, here's some more information, extracted from the
>>>sources:
>>>
>>>Resource (<resource/>) has an optional child <targetPath/> element;
>>>Resource extends FileSet which adds the <directory/> element;
>>>FileSet extends PatternSet which adds <includes/> and <excludes/> tags;
>>>
>>>The includes and excludes are both List's, and are built by nested
>>><include/> and <exclude/> tags respectively. Pretty much maven1 style.
>>>
>>>so the complete set will be:
>>>
>>><project>
>>> ...
>>> <build>
>>> ...
>>>   <resources>
>>>     <resource>
>>>       <directory>src/main/resources</directory>
>>>      <targetPath>whatever/</targetPath>
>>>      <includes>
>>>        <include>*.xcfg</include>
>>>      </includes>
>>>      <excludes>
>>>        <exclude>*.example</exclude>
>>>      </excludes>
>>>     </resource>
>>>   </resources>
>>> ...
>>> </build>
>>> ...
>>></project>
>>>
>>>This is not clear in
>>>http://maven.apache.org/maven2/project-descriptor.html (could use some
>>>indenting and '/' in the ending tags for clarity, there).
>>>
>>>
>>>--
>>>Kenney Westerhof
>>>http://www.neonics.com
>>>GPG public key: http://www.gods.nl/~forge/kenneyw.key
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: [hidden email]
>>>For additional commands, e-mail: [hidden email]
>>>
>>>
>>>
>>>
>>>      
>>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]
>
>
>  
>