You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Howard Lewis Ship <hl...@gmail.com> on 2007/03/02 19:24:50 UTC

Archetype: create resources as companions to java source files

I'm trying to create a archetype where some of my Java source files
have related resources.  Thus, if I have a Java source as
src/main/java/pages/Start.java, I would like to have a companion
src/main/resources/pages/Start.properties.

In the generated application, these would both be qualified with the
package name, ex: src/main/java/org/example/myapp/pages/Start.java and
src/main/resources/org/example/myapp/pages/Start.properties.

The .java file is no problem, but I haven't found how to do the
related resource.

As a <resource> under <resources>, it isn't put in the proper
directory (the package name interpolation does not occur).

As a <source> under <sources>, it doesn't seem to do anything at all.

Ideas?

-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


Re: Archetype: create resources as companions to java source files

Posted by Wendy Smoak <ws...@gmail.com>.
On 3/6/07, Howard Lewis Ship <hl...@gmail.com> wrote:

> Any point in me looking at it at this point?  The structure you have
> in the quickstart matches what I'm trying to do.

I think we have the info we need at this point.  Thanks for bringing
this up, it's something I noticed a while ago but never had time to
track down.

-- 
Wendy

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


Re: Archetype: create resources as companions to java source files

Posted by Howard Lewis Ship <hl...@gmail.com>.
Any point in me looking at it at this point?  The structure you have
in the quickstart matches what I'm trying to do.

On 3/3/07, Wendy Smoak <ws...@gmail.com> wrote:
> On 3/3/07, Wendy Smoak <ws...@gmail.com> wrote:
>
> > Howard, can you take a look at it?  It demonstrates your use case with
> > a .properties file, and also one with html files for Javadoc that I
> > ran into with an archetype for Shale.
>
> FYI:   http://jira.codehaus.org/browse/ARCHETYPE-65
>        Restore the ability to "package" non-Java resources
>
> --
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


Re: Archetype: create resources as companions to java source files

Posted by Wendy Smoak <ws...@gmail.com>.
On 3/3/07, Wendy Smoak <ws...@gmail.com> wrote:

> Howard, can you take a look at it?  It demonstrates your use case with
> a .properties file, and also one with html files for Javadoc that I
> ran into with an archetype for Shale.

FYI:   http://jira.codehaus.org/browse/ARCHETYPE-65
       Restore the ability to "package" non-Java resources

-- 
Wendy

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


Re: Archetype: create resources as companions to java source files

Posted by Wendy Smoak <ws...@gmail.com>.
On 3/3/07, Wendy Smoak <ws...@gmail.com> wrote:

> I think a good way to demonstrate the problem would be to patch the
> quickstart archetype to include both a package.html file (which should
> live in src/main/java so it doesn't get included in the jar) and
> src/main/resources/App.properties which should get packaged with the
> Java source and included in the jar.

That immediately raised the problem of needing package.html to land in
the package structure, but overview.html to stay at the top, directly
in src/main/java.

I took the quickstart archetype to the Maven sandbox and added the
files mentioned above:
http://svn.apache.org/repos/asf/maven/sandbox/trunk/archetype/maven-archetype-quickstart/

Howard, can you take a look at it?  It demonstrates your use case with
a .properties file, and also one with html files for Javadoc that I
ran into with an archetype for Shale.

There is already an issue open that talks about package.html (which
mysteriously just does not get included in the archetype jar).
http://jira.codehaus.org/browse/ARCHETYPE-62

And at this point, we should adjourn to the dev list to talk about how
to fix this. :)

-- 
Wendy

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


Re: Archetype: create resources as companions to java source files

Posted by Wendy Smoak <ws...@gmail.com>.
On 3/2/07, Howard Lewis Ship <hl...@gmail.com> wrote:

> As a <resource> under <resources>, it isn't put in the proper
> directory (the package name interpolation does not occur).
>
> As a <source> under <sources>, it doesn't seem to do anything at all.
>
> Ideas?

This (package name interpolation) used to work if you specified your
resources in the <sources> section.  But last time I tried it, I got
an error from a <sources> element that was not in src/main/java.
There seems to be no way to get non-Java resources into a package
structure now.

I think a good way to demonstrate the problem would be to patch the
quickstart archetype to include both a package.html file (which should
live in src/main/java so it doesn't get included in the jar) and
src/main/resources/App.properties which should get packaged with the
Java source and included in the jar.

-- 
Wendy

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


Re: Archetype: create resources as companions to java source files

Posted by Manos Batsis <ma...@geekologue.com>.
Howard Lewis Ship wrote:
> <archetype>
[...]
> </archetype>


Hey thanks!


> <source> appears to work with -DpackageName=x.y.z to place the various
> Java places in the right place under src/main/java.
> 
> But I can't find the equivalent for a resource file.

Hmm. How about just adding those to <sources>?

Manos
> 
> On 3/3/07, Manos Batsis <ma...@geekologue.com> wrote:
>> Howard Lewis Ship wrote:
>> > I'm trying to create a archetype where some of my Java source files
>> > have related resources.  Thus, if I have a Java source as
>> > src/main/java/pages/Start.java, I would like to have a companion
>> > src/main/resources/pages/Start.properties.
>> >
>> > In the generated application, these would both be qualified with the
>> > package name, ex: src/main/java/org/example/myapp/pages/Start.java and
>> > src/main/resources/org/example/myapp/pages/Start.properties.
>> >
>> > The .java file is no problem, but I haven't found how to do the
>> > related resource.
>>
>> Err, i cant really answer your question but can you please tip me on how
>> to do this for the java files at least? I asked the question some time
>> ago [1], maybe my terminology probably stopped people from passing an
>> answer.
>>
>> I was thinking to go the antrun route and work something out there, in
>> any case if a solution is available it would be of great help.
>>
>> [1]
>> http://www.nabble.com/Arbitary-directory-package-names-with-archetype:create--t3285139s177.html 
>>
>>
>> Many thanks in advance,
>>
>> Manos
>>
>> ---------------------------------------------------------------------
>> 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: Archetype: create resources as companions to java source files

Posted by Howard Lewis Ship <hl...@gmail.com>.
<archetype>
    <id>tapestry-simple</id>
    <resources>
        <resource>.classpath</resource>
        <resource>.project</resource>
        <resource>src/main/webapp/WEB-INF/web.xml</resource>
        <resource>src/main/webapp/WEB-INF/Start.html</resource>
        <resource>src/main/resources/log4j.properties</resource>
        <resource>src/test/java/PLACEHOLDER</resource>
        <resource>src/test/resources/PLACEHOLDER</resource>
    </resources>
    <sources>
        <source>src/main/java/pages/Start.java</source>
        <source>src/main/java/services/AppModule.java</source>
    </sources>
</archetype>

<source> appears to work with -DpackageName=x.y.z to place the various
Java places in the right place under src/main/java.

But I can't find the equivalent for a resource file.

On 3/3/07, Manos Batsis <ma...@geekologue.com> wrote:
> Howard Lewis Ship wrote:
> > I'm trying to create a archetype where some of my Java source files
> > have related resources.  Thus, if I have a Java source as
> > src/main/java/pages/Start.java, I would like to have a companion
> > src/main/resources/pages/Start.properties.
> >
> > In the generated application, these would both be qualified with the
> > package name, ex: src/main/java/org/example/myapp/pages/Start.java and
> > src/main/resources/org/example/myapp/pages/Start.properties.
> >
> > The .java file is no problem, but I haven't found how to do the
> > related resource.
>
> Err, i cant really answer your question but can you please tip me on how
> to do this for the java files at least? I asked the question some time
> ago [1], maybe my terminology probably stopped people from passing an
> answer.
>
> I was thinking to go the antrun route and work something out there, in
> any case if a solution is available it would be of great help.
>
> [1]
> http://www.nabble.com/Arbitary-directory-package-names-with-archetype:create--t3285139s177.html
>
> Many thanks in advance,
>
> Manos
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


Re: Archetype: create resources as companions to java source files

Posted by Manos Batsis <ma...@geekologue.com>.
Howard Lewis Ship wrote:
> I'm trying to create a archetype where some of my Java source files
> have related resources.  Thus, if I have a Java source as
> src/main/java/pages/Start.java, I would like to have a companion
> src/main/resources/pages/Start.properties.
> 
> In the generated application, these would both be qualified with the
> package name, ex: src/main/java/org/example/myapp/pages/Start.java and
> src/main/resources/org/example/myapp/pages/Start.properties.
> 
> The .java file is no problem, but I haven't found how to do the
> related resource.

Err, i cant really answer your question but can you please tip me on how 
to do this for the java files at least? I asked the question some time 
ago [1], maybe my terminology probably stopped people from passing an 
answer.

I was thinking to go the antrun route and work something out there, in 
any case if a solution is available it would be of great help.

[1] 
http://www.nabble.com/Arbitary-directory-package-names-with-archetype:create--t3285139s177.html

Many thanks in advance,

Manos

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