aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Problem with mvn archetype using Eclipse plugin Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Problem with mvn archetype using Eclipse plugin" Watch "Problem with mvn archetype using Eclipse plugin" New topic
Author

Problem with mvn archetype using Eclipse plugin

Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 268
I have installed the maven plugin in eclipse.When i click on File -> New -> Project -> Maven -> Maven Project. Then I give the project name e.g. Maven. Now when I click on next it ask the details for the artifact and project layout. I give those details. When I click on next it asks me for the dependencies. I add the dependencies. Now the problem is that when I click on Finish then I am able to see the project layout, but I am not able to see the folder structure which I gave in the artifact. Why is this happening. Also when i run the command
mvn archetype:create -DgroupId=com.oreilly -DartifactId=my-app
it creates the correct folder structure. How do I simulate this command from eclipse. OR do I have to run mvn archetype: create from the command prompt only. Please Help !!!
Adewale Adebusoye
Ranch Hand

Joined: Sep 28, 2005
Posts: 118
I am also having issues with maven and eclipse, I keep getting crazy dependency errors, and when I fix one, another one rears its head...If you find anything, please post it here.
But, I got the archetypes to work..I am developing an atlassian plug-in, and I used the mvn eclipse:eclipse command to set the archetype up as an eclipse project...now getting eclipse to see the project without any errors is where am stuck.


"Human beings can alter their lives by altering their state of mind" William James
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16228
    
  21

It might be easier to do the following:

1. Create the maven project from the command line, like you demonstrated.

mvn archetype:create -DgroupId=com.oreilly -DartifactId=my-app

2. cd to the project directory and do the following to set up the Eclipse support files:

mvn eclipse:eclipse

If Eclipse is currently running, use the new project wizard to tell the IDE to pick up this new project. You may have to refresh the project to make all the added files show up.


Customer surveys are for companies who didn't pay proper attention to begin with.
Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 268

1. Create the maven project from the command line, like you demonstrated.


My basic question is do I have to run mvn:archetype from the command line. Can't I run it from eclipse, if I have installed the maven plugin. Please do guide me on running mvn:archetype from eclipse if it is possible.
I understood that we can run mvn:archetype from the command line and then go to the project directory and then do mvn eclipse:eclipse. I wanna know, is there any way to run these commands from Eclipse OR do I run these commands form the command line only. Please do clear my confusion.
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

I just created a test project using the Eclipse Maven plugin (used the development version, as it has some issues fixed with repository settings that I use.) What exactly is wrong with the folder structure created by the Eclipse Maven plugin...


Now the problem is that when I click on Finish then I am able to see the project layout, but I am not able to see the folder structure which I gave in the artifact.

What do you mean by "folder structure"? All the projects internal folder structure (i.e. src/main/java, src/main/resources, src/test/java, etc.) that I specified exist. Do you mean the groupid and artifactid of the project itself? I don't see that eclipse created these... so it looks like if you need a nested project structure, you'll have to use the command line to create the structure. The plugin should be fine for single module, non-nested projects though.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16228
    
  21

I've never done it, actually. However, one way that should work is to define the maven prototype command as an external tool.

For a long time, the Linux version of Eclipse couldn't print - the authors claimed there was no universal mechanism they could tap into, so the File/Print menu didn't work. I used an OS print utility program as an Eclipse external command.
Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 268
Yeah all the projects internal folder structure(i.e. src/main/java, src/main/resources, src/test/java, etc.) does exist.

Do you mean the groupid and artifactid of the project itself? I don't see that eclipse created these...


Yeah I do mean the groupId and artifactId of the project itself. The plugin should be able to create that also. What's the use if I create a part of the structure through plugin and then another part of the structure through the command line. The plugin should be able to create my groupId and artifactId in the folder structure also.
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Re-checked using the maven command line archetype:create and it only creates a directory using the artifactid, not a directory with the groupid. In Eclipse, it is possible to "override" this by naming your Eclipse project a different name than your artifactid, but just always use the same name for the project and the artifactid and there will be no difference. Still no fix for hierarchical projects though there are some suggested partial workarounds in the Maven Eclipse plugin FAQ.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with mvn archetype using Eclipse plugin