You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dave Hoffer <DH...@xrite.com> on 2007/03/07 18:11:45 UTC

How to create custom archetype?

I am having some trouble creating my custom archetype.  I followed the
docs given at
http://maven.apache.org/plugins/maven-archetype-plugin/examples/archetyp
e.html however it is not clear how to include my default source & test
files.  I have:

<sources>
    <source>src/main/java/App.java</source>
  </sources>
  <testSources>
    <source>src/test/java/AppTest.java</source>
  </testSources>

I have the files in the exact same directory structure under
archetype-resources.  However when I use this custom archetype, I get a
different directory structure generated.  It adds a directory called my
<groupId> between the java folder and my class(s).


How is this supposed to work?

-dh

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


RE: How to create custom archetype?

Posted by Dave Hoffer <DH...@xrite.com>.
Wendy,

Thanks much, that does the job:)

Dave

-----Original Message-----
From: Wendy Smoak [mailto:wsmoak@gmail.com] 
Sent: Wednesday, March 07, 2007 1:41 PM
To: Maven Users List
Subject: Re: How to create custom archetype?

On 3/7/07, Dave Hoffer <DH...@xrite.com> wrote:
> The problem is that those sources don't know they are going into a
> package structure that matches the groupId.  Since the files start
with
> no namespace they end up with none; and the resulting project does not
> build.
>
> Am I supposed to put some macro in the files so the package namespace
> can get set correctly?

package $package;

Take a look at the quickstart archetype for an example:
http://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bu
ndles/maven-archetype-quickstart/

-- 
Wendy

---------------------------------------------------------------------
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: How to create custom archetype?

Posted by Wendy Smoak <ws...@gmail.com>.
On 3/7/07, Dave Hoffer <DH...@xrite.com> wrote:
> The problem is that those sources don't know they are going into a
> package structure that matches the groupId.  Since the files start with
> no namespace they end up with none; and the resulting project does not
> build.
>
> Am I supposed to put some macro in the files so the package namespace
> can get set correctly?

package $package;

Take a look at the quickstart archetype for an example:
http://svn.apache.org/repos/asf/maven/archetype/trunk/maven-archetype-bundles/maven-archetype-quickstart/

-- 
Wendy

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


Re: How to create custom archetype?

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

> If you want a different package name, try supplying -Dpackage=... when
> you use the archetype.

Oops.  It's  -DpackageName=...

http://maven.apache.org/plugins/maven-archetype-plugin/usage.html

-- 
Wendy

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


RE: How to create custom archetype?

Posted by Dave Hoffer <DH...@xrite.com>.
The problem is that those sources don't know they are going into a
package structure that matches the groupId.  Since the files start with
no namespace they end up with none; and the resulting project does not
build.

Am I supposed to put some macro in the files so the package namespace
can get set correctly?

Dave

-----Original Message-----
From: Wendy Smoak [mailto:wsmoak@gmail.com] 
Sent: Wednesday, March 07, 2007 12:33 PM
To: Maven Users List
Subject: Re: How to create custom archetype?

On 3/7/07, Dave Hoffer <DH...@xrite.com> wrote:

> I have the files in the exact same directory structure under
> archetype-resources.  However when I use this custom archetype, I get
a
> different directory structure generated.  It adds a directory called
my
> <groupId> between the java folder and my class(s).
>
> How is this supposed to work?

That's how it's supposed to work-- it's putting your sources into a
package structure matching the groupId.

If you want a different package name, try supplying -Dpackage=... when
you use the archetype.

It sounds like you want the default package, though.  (No package
statement, files directly in src/main/java.)  Is that true?

-- 
Wendy

---------------------------------------------------------------------
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: How to create custom archetype?

Posted by Wendy Smoak <ws...@gmail.com>.
On 3/7/07, Dave Hoffer <DH...@xrite.com> wrote:

> I have the files in the exact same directory structure under
> archetype-resources.  However when I use this custom archetype, I get a
> different directory structure generated.  It adds a directory called my
> <groupId> between the java folder and my class(s).
>
> How is this supposed to work?

That's how it's supposed to work-- it's putting your sources into a
package structure matching the groupId.

If you want a different package name, try supplying -Dpackage=... when
you use the archetype.

It sounds like you want the default package, though.  (No package
statement, files directly in src/main/java.)  Is that true?

-- 
Wendy

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