I've found plenty of info online about fancy maven setups, but being newer to Maven, it's the "hello world" level stuff that's not quite clear.
Goal: Create a single, simple Maven project from Eclipse, and get it checked into our Subversion repository. Checkin the correct files, and don't include stuff that shouldn't be checked in. Step 2 would to get a second Eclipse workstation also working on the same project.
Caveats: Yes, I'm relatively new to Maven. And non-maven bootstrapping between Eclipse and SVN isn't always 100% clear to me.
System:
- OS X Snow Leopard w default Java 1.6
- Eclipse 3.6 and recently installed plgins
- Subclipse and the Collab.net version of SVN - working
- m2eclipse, also working
- Command line mvn working, local repository, can create projects
- Subversion repository via https
I won't bore you with all my false starts, but this is a summary of the current state:
- Created a project on our SVN server, with URL of the form https://foo.com/svn/PROJECTONE/trunk
- Create the Maven project from within Eclipse, with m2eclipse, vs. fighting with the command line tool (at least while learning)
- Start with a blank Eclipse workspace, and accept default location for new project
- New Project wizard, maven project, using maven-archtype-quckstart, call it ProjectOne
- In POM editor fill in SCM URL with Subversion URL above, https://foo.com/svn/PROJECTONE/trunk
- Modify maven's default App.java program, change the Hello World string, verify that it runs
Here's some of the things I find odd: (obviously I'm misunderstanding something)
- In the POM editor, now that I've filled in the SCM URL to my SVN repository, I would have expected it to offer to checkin my code. No offer, and I haven't noticed any additional options. Question: What's the point of this field then? Given maven's task oriented concept, and that it asked about my URL, wouldn't getting the file sync'd be part of that?
- I decided to do it manually, I right clicked the project and, under Team, told it about the SVN URL, it warns that the directory already exists, I say OK, and the directories are now linked.
- Then I start the checkin process and I notice that Subclipse is suggesting some of the files under .settings. Certainly Ecliipse binary workspace files shouldn't be checked in, and it looks like one of the plugins figured out not to include the build directory (?), but not sure on these files. Question: To what extent, if any, does Maven update svn:ignore properties? Or does Subclipse update svn:ignore, based on Eclipse project settin开发者_高级运维gs, since it does have knowledge of both?
General questions:
- What would have been the "best practice" for bootstrapping a single new Maven project into Eclipse and Subversion? Which tasks go first?
- What would the "best practice" be for getting that project into a second Eclipse workstation, assuming it had all the plugins?
- Which plugins (m2eclipse, subclipse, etc) update svn:ignore ?
- When the POM editor asks about the SCM URL, what does it use that information for?
- Should I include "trunk" in that SCM URL?
- Should I include the Project name in the SCM URL?
- Should I have created the project directory first in repository? Or should I have let one of the plugins create it?
- Do m2eclipse and subclipse recognize each other? Or, maybe more likely, do the core maven and subversion systems know anything about each other? For example, does maven generally know about svn:ignore? I wouldn't expect subversion to know much about maven, seems like the wrong direction.
Apologies for the long post, but these are all somewhat related, and maybe give a better context about what a new maven user might be thinking.
Which plugins (m2eclipse, subclipse, etc) update svn:ignore ? recommend both m2eclipse and subclipse.
About svn ignore you have two ways to ignore the eclipse generated artifacts when you check in your source :
Using Subclipse
Right Click -> Team - > Set Property In Enter property enter the following properties :
- target
- .classpth
- .settings
- .project
- .wtpmodules
Using Svn
$ svn propset svn:ignore 'target .classpath .settings .project .wtpmodules' . $ svn commit -m"remove eclipse artifacts" .
When the POM editor asks about the SCM URL, what does it use that information for?
The SCM can be used for reporting purpose or can be used with Maven Release Plugin. The plugin automate the entire release process.
Should I have created the project directory first in repository? Or should I have let one of the plugins create it?
You can create the directory layout using an archetype provided by the archetype:plugin.
As far as I know...
Maven has almost nothing to do with SVN [EDIT: for your goal], forget about Maven SCM for now as you don't need it right now.
To make Maven and Eclipse work together you need to make them use same classpath and output directory and that's what a correctly configured plugin will do for you. It will also let you do Maven tasks (running goals, etc.) inside Eclipse.
A Subversion client keep track of changes you make and let you do Subversion task (sync, update, checkout, commit, etc.). Subclipse is Eclipse Subversion plugin.
After you made Maven and Eclipse work together use SVN (Subclipse or whatever) to share your project files including pom.xml, .classpath, .project and may be .settings but excluding all derived files (compiler output, etc.).
精彩评论