You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by John Farrell <Fa...@cat.com> on 2003/08/05 08:48:03 UTC

how do I get resources in my jar file?

I am running maven beta 10, and cannot get resources copied into my jar file. 
I have made extensive investigations. In the POM, I have this:

    <resources>
      <resource>
        <directory>${basedir}/src/res</directory>
        <includes>
          <include>*.properties</include>
        </includes>
      </resource>
    </resources>

I found this goal which seems to copy resources as I need:

  <goal name="java:jar-resources"
        description="Copy any resources that must be present in the deployed 
JAR file">

    <j:if test="${!pom.build.resources.isEmpty()}">
      <echo>${pom.build.resources}</echo>
      <resources:copy
        resources="${pom.build.resources}"
        todir="${maven.build.dest}"
      />
    </j:if>
  </goal>

Notice I have added an echo there, so when I do "maven java:jar-resources", I 
get:

java:jar-resources:
    [echo] [[dir = /home/john/mainline/mp-base/src/res]]
BUILD SUCCESSFUL

It looks to me as if the setting in the POM is accessible from 
java:jar-resources. But what calls java:jar-resources? java:jar does not, it 
just calls jar:jar. jar:jar does not. Nothing seems to, actually.

I tried adding a preGoal to maven.xml, 

    <preGoal name="jar:jar">
      <attainGoal name="java:jar-resources" />
    </preGoal>

but that didn't seem to achieve it, because there are still no resources in 
the jar. Could someone please advise on how it's supposed to work, and what 
I'm doing wrong? Thanks,

John

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


Re: how do I get resources in my jar file?

Posted by John Farrell <Fa...@cat.com>.
On Tue, 5 Aug 2003 04:54 pm, Andy Jefferson wrote:
> On Tuesday 05 Aug 2003 07:48, John Farrell wrote:
> > I am running maven beta 10, and cannot get resources copied into my jar
> > file. I have made extensive investigations. In the POM, I have this:
> >
> >     <resources>
> >       <resource>
> >         <directory>${basedir}/src/res</directory>
> >         <includes>
> >           <include>*.properties</include>
> >         </includes>
> >       </resource>
> >     </resources>
>
> I've the same except for
>
> <include>**/*.properties</include>
>
> and this puts all properties file in the JAR without problems.

Thanks Andy, that was it. Silly me :-(.

John

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


Re: how do I get resources in my jar file?

Posted by Andy Jefferson <an...@ajsoft.net>.
On Tuesday 05 Aug 2003 07:48, John Farrell wrote:
> I am running maven beta 10, and cannot get resources copied into my jar
> file. I have made extensive investigations. In the POM, I have this:
>
>     <resources>
>       <resource>
>         <directory>${basedir}/src/res</directory>
>         <includes>
>           <include>*.properties</include>
>         </includes>
>       </resource>
>     </resources>

I've the same except for

<include>**/*.properties</include>

and this puts all properties file in the JAR without problems.


-- 
Andy

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


Re: how do I get resources in my jar file?

Posted by "Jefferson K. French" <je...@frenches.org>.
test:compile has java:jar-resources as a prereq.

On Tue, 5 Aug 2003, at 16:48:03 [GMT +1000] John Farrell wrote:

> It looks to me as if the setting in the POM is accessible from
> java:jar-resources. But what calls java:jar-resources? java:jar does not, it 
> just calls jar:jar. jar:jar does not. Nothing seems to, actually.

-- 
mailto:jeff@frenches.org



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


Re: how do I get resources in my jar file?

Posted by di...@multitask.com.au.
jar:jar has a pre-req of test:test

test:test has a pre-req of test:compile

test:compile has a pre-req of 
java:compile,java:jar-resources,test:prepare-filesystem,test:test-resources

Can you post your project.xml?
--
dIon Gillard, Multitask Consulting
Blog:      http://blogs.codehaus.org/people/dion/


John Farrell <Fa...@cat.com> wrote on 05/08/2003 04:48:03 PM:

> I am running maven beta 10, and cannot get resources copied into my jar 
file. 
> I have made extensive investigations. In the POM, I have this:
> 
>     <resources>
>       <resource>
>         <directory>${basedir}/src/res</directory>
>         <includes>
>           <include>*.properties</include>
>         </includes>
>       </resource>
>     </resources>
> 
> I found this goal which seems to copy resources as I need:
> 
>   <goal name="java:jar-resources"
>         description="Copy any resources that must be present in the 
deployed 
> JAR file">
> 
>     <j:if test="${!pom.build.resources.isEmpty()}">
>       <echo>${pom.build.resources}</echo>
>       <resources:copy
>         resources="${pom.build.resources}"
>         todir="${maven.build.dest}"
>       />
>     </j:if>
>   </goal>
> 
> Notice I have added an echo there, so when I do "maven 
java:jar-resources", I 
> get:
> 
> java:jar-resources:
>     [echo] [[dir = /home/john/mainline/mp-base/src/res]]
> BUILD SUCCESSFUL
> 
> It looks to me as if the setting in the POM is accessible from 
> java:jar-resources. But what calls java:jar-resources? java:jar does 
not, it 
> just calls jar:jar. jar:jar does not. Nothing seems to, actually.
> 
> I tried adding a preGoal to maven.xml, 
> 
>     <preGoal name="jar:jar">
>       <attainGoal name="java:jar-resources" />
>     </preGoal>
> 
> but that didn't seem to achieve it, because there are still no resources 
in 
> the jar. Could someone please advise on how it's supposed to work, and 
what 
> I'm doing wrong? Thanks,
> 
> John
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>