天天看點

maven in action(九) myeclipse maven項目svn管理

項目搭建完畢後,還有一個關鍵是怎樣送出maven代碼到svn,團隊中的其他人怎樣根據svn位址下載下傳maven源碼,并生成maven項目?

maven送出到svn

送出svn,主要是送出源代碼,送出src/main/java 檔案夾下的源代碼,送出資源檔案src/main/resources,送出pom.xml檔案; 如有需要把測試代碼一起送出,其他的就不需要送出。

從myeclipse導入svn 

用myeclipse導入 --選擇從svn導入--選擇svn位址後,檢出為--作為工作空間中的項目檢出--修改項目名稱,之後下載下傳下來的是源代碼和檔案。找到項目的位置,修改project 檔案中maven項目的相關屬性 , 然後再F5重新整理我們的項目, 這樣就可以運作啦。修改的.project 檔案代碼如下 :

<buildSpec>
		<buildCommand>
			<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
			<triggers>full,incremental,</triggers>
			<arguments>
				<dictionary>
					<key>LaunchConfigHandle</key>
					<value><project>/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator (2).launch</value>
				</dictionary>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.wst.common.project.facet.core.builder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.wst.validation.validationbuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.m2e.core.maven2Builder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>com.genuitec.eclipse.j2eedt.core.webnature</nature>
		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
		<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
		<nature>org.eclipse.jdt.core.javanature</nature>
		<nature>org.eclipse.m2e.core.maven2Nature</nature>
		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
		<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
	</natures>
           

這樣就可以送出svn和下載下傳svn代碼,并在本地上運作和測試maven項目了。