I was able to code a workaround using Ant to create the project then
"archetype:create-from-project" to create it. The nice thing about using Ant
to do this was I was also able to modify errors in the create process to
make working archetypes.
After doing this, I've discovered that the code I was using to materialize
archetypes automatically no longer works. The code is below and the error
I'm experiencing is as follows:
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
Caused by: org.apache.velocity.exception.ParseErrorException: Lexical error:
org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line 102,
column 93. Encountered: <EOF> after : ""
at org.apache.velocity.Template.process(Template.java:141)
at
org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:423)
at
org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:341)
at
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:831)
at
org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:440)
at
org.apache.maven.archetype.DefaultArchetype.processTemplate(DefaultArchetype.java:904)
protected void createTestProject(String archetypeArtifactId, String
archetypeVersion) throws Exception {
MavenProject project = getMavenProject();
FileUtils.deleteDirectory(getTestFile("target/" +
project.getArtifactId()));
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("groupId", project.getGroupId());
parameters.put("artifactId", project.getArtifactId());
parameters.put("version", "1.0-SNAPSHOT");
parameters.put("basedir", getTestFile("target").getAbsolutePath());
Archetype archetype = (Archetype) lookup(Archetype.ROLE);
ArtifactRepositoryLayout layout =
(ArtifactRepositoryLayout)
container.lookup(ArtifactRepositoryLayout.ROLE, "default");
String mavenRepoLocal = "file://" + System.getProperty("user.home")
+ System.getProperty("file.separator") +
".m2" + System.getProperty("file.separator") + "repository";
ArtifactRepository localRepository = new
DefaultArtifactRepository("local", mavenRepoLocal, layout);
List<ArtifactRepository> remoteRepositories = new
ArrayList<ArtifactRepository>();
/*String mavenRepoRemote = "http://repo1.maven.org/maven2";
ArtifactRepository remoteRepository = new
DefaultArtifactRepository("remote", mavenRepoRemote, layout);
remoteRepositories.add(remoteRepository);*/
String archetypeGroupId = "org.appfuse.archetypes";
archetype.createArchetype(archetypeGroupId, archetypeArtifactId,
archetypeVersion, localRepository,
remoteRepositories, parameters);
}
Any ideas?
Thanks,
Matt
Grant Rettke wrote:
>
> On Fri, Apr 24, 2009 at 4:24 AM, mraible <[email protected]> wrote:
>> I'd like to hand-craft an archetype that consists of a single pom.xml and
>> pulls it's sources from other modules/directories in my project. Is that
>> possible?
>
> That seems to go against the grain of Maven.
>
> Does Maven make stuff like this easy?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
--
View this message in context:
http://www.nabble.com/Is-it-possible-to-add-files-to-an-archetype-from-other-directories--tp23212840p23265718.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]