You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Matthew Runo <mr...@zappos.com> on 2009/11/12 19:48:39 UTC
Archetype creation w/ metadata
Hello folks!
I hope this makes sense, as I'm about out of ideas as to how to go about getting my archetype to work as needed. I have two outstanding issues that I can't seem to squash.
1. When I use my archetype to make a project, I get an extra directory and I'm not sure how... Here's the resulting directory structure, when I create my app from /Users/mruno:
test-app
- pom.xml
^ src
-- all the stuff under src is properly placed
^ Users
- ^ mruno... and so on, to create an empty "resources" directory under /Users/mruno/test/src/main/resources and /Users/mruno/test/src/test/resources
I've no idea how or why these two empty directories are being created. When I check out the archetype from / I do not get this directory, leading me to think it's some sort of path issue.
2. I need to ask the user for some input to customize the project before Velocity goes through and does its variable replacement. I've tried making an archetype-metadata.xml but it seems like this file is ignored. How can I make maven use that file? I have created an archetype.xml as well, and it seems to be used. I've attached both files here:
--= archetype.xml =--
<?xml version="1.0" encoding="UTF-8"?><archetype>
<id>site-manager-app</id>
<sources>
<source filtered="true">src/main/java/TestControl.java</source>
</sources>
<testSources>
<source filtered="true">src/test/java/TestControlTest.java</source>
</testSources>
<resources>
<resource filtered="true">src/main/resources/build.properties</resource>
<resource filtered="true">src/main/resources/log4j.xml</resource>
<resource filtered="true">src/test/resources/build.properties</resource>
<resource filtered="true">src/main/webapp/WEB-INF/web.xml</resource>
<resource filtered="true">src/main/webapp/WEB-INF/spring-security.xml</resource>
<resource filtered="true">src/main/webapp/WEB-INF/spring-servlet.xml</resource>
</resources>
<siteResources>
<resource filtered="false">src/main/webapp/WEB-INF/freemarker/header.ftl</resource>
<resource filtered="false">src/main/webapp/WEB-INF/freemarker/login.ftl</resource>
<resource filtered="false">src/main/webapp/WEB-INF/freemarker/macros/library.ftl</resource>
<resource filtered="false">src/main/webapp/WEB-INF/freemarker/test.ftl</resource>
</siteResources>
</archetype>
--= archetype-metadata.xml =--
<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor name="site-manager-app" partial="true">
<id>site-manager-app</id>
<requiredProperties>
<requiredProperty key="name">
<defaultValue>My Sample Application</defaultValue>
</requiredProperty>
<requiredProperty key="description" />
</requiredProperties>
<fileSets>
<fileSet packaged="true" encoding="UTF-8">
<directory>./src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet packaged="true" encoding="UTF-8">
<directory>./src/test/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory>./src/main/webapp/WEB-INF</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory>./src/main/resources</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory>./src/test/resources</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory>./src/main/webapp/WEB-INF/freemarker</directory>
<includes>
<include>*.ftl</include>
<include>**/*.ftl</include>
</includes>
</fileSet>
</archetype-descriptor>
I really appreciate your time and help! Forgive me if I'm making silly mistakes... so far as I can tell though, I'm not.
Matthew Runo
Software Engineer, Zappos.com
mruno@zappos.com - 702-943-7833
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Archetype creation w/ metadata
Posted by Matthew Runo <mr...@zappos.com>.
So, I've managed to fix my duplicated directory issue. Apparently I do not need fully qualified path's in my pom file like I thought I did.
I still cannot get maven to recognize my archetype-metadata.xml file though.
Thanks for your time!
Matthew Runo
Software Engineer, Zappos.com
mruno@zappos.com - 702-943-7833
On Nov 12, 2009, at 10:48 AM, Matthew Runo wrote:
> Hello folks!
>
> I hope this makes sense, as I'm about out of ideas as to how to go about getting my archetype to work as needed. I have two outstanding issues that I can't seem to squash.
>
> 1. When I use my archetype to make a project, I get an extra directory and I'm not sure how... Here's the resulting directory structure, when I create my app from /Users/mruno:
>
> test-app
> - pom.xml
> ^ src
> -- all the stuff under src is properly placed
> ^ Users
> - ^ mruno... and so on, to create an empty "resources" directory under /Users/mruno/test/src/main/resources and /Users/mruno/test/src/test/resources
>
> I've no idea how or why these two empty directories are being created. When I check out the archetype from / I do not get this directory, leading me to think it's some sort of path issue.
>
> 2. I need to ask the user for some input to customize the project before Velocity goes through and does its variable replacement. I've tried making an archetype-metadata.xml but it seems like this file is ignored. How can I make maven use that file? I have created an archetype.xml as well, and it seems to be used. I've attached both files here:
>
> --= archetype.xml =--
> <?xml version="1.0" encoding="UTF-8"?><archetype>
> <id>site-manager-app</id>
> <sources>
> <source filtered="true">src/main/java/TestControl.java</source>
> </sources>
> <testSources>
> <source filtered="true">src/test/java/TestControlTest.java</source>
> </testSources>
> <resources>
> <resource filtered="true">src/main/resources/build.properties</resource>
> <resource filtered="true">src/main/resources/log4j.xml</resource>
> <resource filtered="true">src/test/resources/build.properties</resource>
> <resource filtered="true">src/main/webapp/WEB-INF/web.xml</resource>
> <resource filtered="true">src/main/webapp/WEB-INF/spring-security.xml</resource>
> <resource filtered="true">src/main/webapp/WEB-INF/spring-servlet.xml</resource>
> </resources>
> <siteResources>
> <resource filtered="false">src/main/webapp/WEB-INF/freemarker/header.ftl</resource>
> <resource filtered="false">src/main/webapp/WEB-INF/freemarker/login.ftl</resource>
> <resource filtered="false">src/main/webapp/WEB-INF/freemarker/macros/library.ftl</resource>
> <resource filtered="false">src/main/webapp/WEB-INF/freemarker/test.ftl</resource>
> </siteResources>
> </archetype>
>
> --= archetype-metadata.xml =--
> <?xml version="1.0" encoding="UTF-8"?>
> <archetype-descriptor name="site-manager-app" partial="true">
> <id>site-manager-app</id>
> <requiredProperties>
> <requiredProperty key="name">
> <defaultValue>My Sample Application</defaultValue>
> </requiredProperty>
> <requiredProperty key="description" />
> </requiredProperties>
> <fileSets>
> <fileSet packaged="true" encoding="UTF-8">
> <directory>./src/main/java</directory>
> <includes>
> <include>**/*.java</include>
> </includes>
> </fileSet>
> <fileSet packaged="true" encoding="UTF-8">
> <directory>./src/test/java</directory>
> <includes>
> <include>**/*.java</include>
> </includes>
> </fileSet>
> <fileSet encoding="UTF-8">
> <directory>./src/main/webapp/WEB-INF</directory>
> <includes>
> <include>**/*.xml</include>
> </includes>
> </fileSet>
> <fileSet encoding="UTF-8">
> <directory>./src/main/resources</directory>
> <includes>
> <include>**/*.xml</include>
> <include>**/*.properties</include>
> </includes>
> </fileSet>
> <fileSet encoding="UTF-8">
> <directory>./src/test/resources</directory>
> <includes>
> <include>**/*.xml</include>
> <include>**/*.properties</include>
> </includes>
> </fileSet>
> <fileSet encoding="UTF-8">
> <directory>./src/main/webapp/WEB-INF/freemarker</directory>
> <includes>
> <include>*.ftl</include>
> <include>**/*.ftl</include>
> </includes>
> </fileSet>
> </archetype-descriptor>
>
> I really appreciate your time and help! Forgive me if I'm making silly mistakes... so far as I can tell though, I'm not.
>
> Matthew Runo
> Software Engineer, Zappos.com
> mruno@zappos.com - 702-943-7833
>
>
> ---------------------------------------------------------------------
> 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