views:

1084

answers:

1

I created a j2ee-simple project using the maven template with following command-line

 mvn archetype:create -DgroupId=com.hardik -DartifactId=ActionBazaar -DarchetypeArtifactId=maven-archetype-j2ee-simple

When I try to run the install goal within the created project folder I get an error about not existent model file in the site module. The error is described bellow.

When I remove the site module from the root pom.xml it works. Is there any proper way to correct this problem ?

What if I want to keep the site module in order to make website for my project ?

Here the error:

$ mvn install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: unknown

Reason: Could not find the model file '/home/hardik/projects/ActionBazaar/site'. for project unknown


[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Could not find the model file '/home/hardik/projects/ActionBazaar/site'. for project unknown
        at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:432)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:300)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.project.ProjectBuildingException: Could not find the model file '/home/hardik/projects/ActionBazaar/site'. for project unknown
        at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1585)
        at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:506)
        at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:200)
        at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:632)
        at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:515)
        at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:588)
        at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:419)
        ... 11 more
Caused by: java.io.FileNotFoundException: /home/hardik/projects/ActionBazaar/site (No such file or directory)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:106)
        at hidden.org.codehaus.plexus.util.xml.XmlReader.<init>(XmlReader.java:124)
        at hidden.org.codehaus.plexus.util.xml.XmlStreamReader.<init>(XmlStreamReader.java:67)
        at hidden.org.codehaus.plexus.util.ReaderFactory.newXmlReader(ReaderFactory.java:113)
        at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1580)
        ... 17 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Sat Jul 04 07:59:37 CEST 2009
[INFO] Final Memory: 1M/4M
[INFO] ----


+2  A: 

Try updating your maven to begin with. Trying to run this myself, I get the following error:

[WARNING] This goal is deprecated. Please use mvn archetype:generate instead

Aside from that, the archetype doesn't seem to even create a site module - if you ls, you'll notice there is, in-fact, no 'site' directory i.e. no module - that's why you're getting the error, and that's why removing the site fixes the problem. You can of course still make a dedicated site module - just create the directory 'site', and put a minimalist pom in there, which will let the build pass.

And, as I thought, here is the associated archetype bug for this issue: ARCHETYPE-228 . I suggest you vote for it, and 'watch' for when it will be fixed.

But like I said, simply adding the 'site' dir with a minimal pom will fix your problem. But you'll have to find a 'site' template as well. I suggest reading this excellent book from Sonatype (the creators of Maven): The Maven Book - Site Generation - www.sonatype.com/books/maven-book/reference/site-generation.html (unfort, as a new user I can only make one hyper-link - hurumph)

Antony Stubbs