怎么样eclipse发达国家多重聚合关系maven项目和使用git管理
最近使用的项目的开发maven,多于maven有项目之间有一定的联系,因此,创建一个单独的,然后,maven聚合管理。
项目采用git要管理代码。由于上传的代码集时,.gitignore不要上传文件.setting其他文件,因此,git下载之后maven一个elipse项目文件。这样假设在github中拉下代码之后,再导入时不是非常方便。所以这里使用maven的插件,把各个项目变成Eclipse项目。
项目的结构例如以下:
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvS2luZ3Nvbl9XdQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="">
当中encryption是多个maven项目中的当中一个,这些项目都依赖Utils4Java-parent中的pom文件
Utils4Java-parent:
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvS2luZ3Nvbl9XdQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="">
encryption项目(新建的其它maven项目结构也如此):
在这里除了pom文件之外其它项目没有打勾,是由于用git上传到github时在.gitignore文件中被忽略掉了,而src没有被上传是由于目录中我没有加源代码,是空的。
在这里能够看到eclipse项目文件标志的.setting没有被上传。
在eclipse中导入是这种:
一.怎样用maven管理多个项目
Utils4Java-parent的pom文件例如以下。全部的maven项目的pom文件都依赖这个父文件:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <groupId>com.kxw</groupId>
<artifactId>Utils4Java-parent</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Utils4Java-parent</name>
<url>http://maven.apache.org</url> <modules>
<module>../encryption</module>
</modules> <profiles>
<profile>
<id>run_build</id>
<properties>
<log4j.print.sys>false</log4j.print.sys>
</properties>
</profile>
<profile>
<id>dev_build</id>
<properties>
<log4j.print.sys>true</log4j.print.sys>
</properties>
</profile>
</profiles> <repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://nexus.sourcesense.com/nexus/content/repositories/public/</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>4.10</junit.version> </properties> <dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement> <build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<showWarnings>true</showWarnings>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<wtpversion>2.0</wtpversion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<archive>
<manifestEntries>
<Vendor>${project.organization.name}</Vendor>
<Artifact-Id>${project.artifactId}</Artifact-Id>
<Implementation-Version>${project.version}</Implementation-Version>
<Build>${project.build}</Build>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins> </build> </project>
encryption项目中的pom文件例如以下:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.kxw</groupId>
<artifactId>Utils4Java-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../Utils4Java-parent/pom.xml</relativePath>
</parent> <artifactId>encryption</artifactId>
<packaging>jar</packaging> <name>encryption</name>
<url>http://maven.apache.org</url> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> <dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency> </dependencies> </project>
这样就能够在这基础上新建多个maven文件并依赖于父POM文件了。
二.用git管理项目代码
.gitignore文件:
.*.swp
.DS_Store
*target*
*.jar
*.war
*.ear
*.class
classes/
.svn
.classes
.project
.classpath
.settings/
.metadata
bin
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
.classpath
.settings/**
tartget/** git.properties
想了解怎样用git上传代码能够看这里:http://blog.csdn.net/kingson_wu/article/details/38436923
三.使用maven插件把项目变成eclipse项目
这些插件在父POM文件已经配置。仅仅有执行MavenEclipseBuild.bat就可以
cd Utils4Java-parent
call mvn eclipse:clean eclipse:eclipse pause
四.使用maven打包开发(測试)环境和正式环境
mavenProjectBuild.bat正式
cd Utils4Java-parent
call mvn clean install -Dmaven.test.skip=true -Prun_build pause
mavenProjectBuild-Dev.bat开发
cd Utils4Java-parent
call mvn clean install -Dmaven.test.skip=true -Pdev_build pause
parent的pom中:
<profiles>
<profile>
<id>run_build</id>
<properties>
<log4j.print.sys>false</log4j.print.sys>
</properties>
</profile>
<profile>
<id>dev_build</id>
<properties>
<log4j.print.sys>true</log4j.print.sys>
</properties>
</profile>
</profiles>
demo的源代码在:https://github.com/KingsonWu/Kingson4Blog/tree/master/MutipleEclipseMavenProjectDemo
-------------
又一次pull代码之后
先project build
再Eclipse build
然后 project clean(在Eclipse中)
注意:切完 分支之会后再次eclipse.bat,否则,它是依赖于旧。
版权声明:本文博主原创文章。博客,未经同意不得转载。
怎么样eclipse发达国家多重聚合关系maven项目和使用git管理的更多相关文章
- <转>创建支持eclipse的多模块maven项目
如何使用eclipse创建Maven工程及其子模块 1,首先创建一个父类工程 子模块继承父类工程 并在父类工程的pom.xml文件中定义引入的jar及其版本号 子模块可以引用 2 ...
- 在eclipse中创建一个Maven项目
1. 首先判断eclipse有没有自带Maven Window –> Perferences 如果有Maven,那就是自带了maven插件,如果没有,需要自行安装. 2.配置maven 2.1. ...
- 创建支持eclipse的多模块maven项目
通过maven可以创建多个关联模块的项目(Multiple Module Projects).由一个总的模块,下面包含多个子模块(子模块还可以包含子模块). 这种maven功能能支持大型的项目构建,往 ...
- eclipse中如何创建maven项目
1.在eclipse中,file-->new-->maven project,勾选Create a simple project,点击next. 2.添加项目信息,点击finish.(pa ...
- eclipse中创建一个maven项目
1.什么是Maven Apache Maven 是一个项目管理和整合工具.基于工程对象模型(POM)的概念,通过一个中央信息管理模块,Maven 能够管理项目的构建.报告和文档. Maven工程结构和 ...
- maven学习(十七)——在eclipse中导入外部maven项目
外部maven项目,导入Eclipse中进行开发 操作步骤如下所示:
- 如何用eclipse运行导入的maven项目
1.配置jdk系统环境变量.找到安装的jdk的安装目录,新建系统环境变量,变量名为JAVA_HOME(作为一个引用),变量值为该路径. 找到Path,将%JAVA_HOME%/bin; 添加到变量值的 ...
- eclipse中SpringBoot的maven项目出现无法解析父类的解决办法
在eclipse中建立SpringBoot的maven项目时,继承父类,添加如下代码: <parent> <groupId>org.springframework.boot&l ...
- Eclipse创建一个普通maven项目详细步骤
首先找到Eclipse最顶部左边的File,new一个 Maven Project项目 下一步,勾选第二个即可 下一步,选择 maven-archetype-webapp Group Id 写域名倒 ...
随机推荐
- 使用cocos2d 2.1制作一条河游戏(4): 主要的游戏逻辑BaseLayer设计
前段时间一直忙着.没有时间更新博客.今天,仍然需要一段时间才能实现对游戏的一小部分,最后打动他. BaseLayer.h: #import <GameKit/GameKit.h> #imp ...
- const使用摘要
const在四种方案如以下: int b = 500; const int *a = &b; ①(底层const) int const *a = &b; ②(底层const) int ...
- Bulk Insert Data
Bulk Insert Data 命名空间:Oracle.DataAccess.Client 组件:Oracle.DataAccess.dll(2.112.1.0) ODP.NET 版本:ODP.NE ...
- How to Compile Java DBus
1 download or git clone Java DBus git clone git://anongit.freedesktop.org/dbus/dbus-java dbus-java 2 ...
- 【HTML+CSS】(1)基本语法
HTML基金会 <em>他强调标签,<strong>加粗标签 <q>短文本引用.<blockquote>长文本引用,这两个标签会让文字带双引號. 空 ...
- 怎么样Eclipse IDE for C/C++ Developers正确编译GTK规划?(解决)
<span style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 25.99 ...
- 每天进步一点点——再次了解Linux进程ID
转载请注明出处:http://blog.csdn.net/cywosp/article/details/38968011 1. 概述 众所周知,进程(process)是一个可运行程序的实例,可是在Li ...
- ubuntu12.04硬盘安装
ubuntu12.04发布了 , 安装又是一个话题.安装系统有很多方法,比如livecd,和u盘,但这些都需借用外部设备,所以硬盘安装是最好不过的方法了.u盘,cd安装都非常的简 单,对于那些讨厌用光 ...
- Android SwipeRefreshLayout 官方下拉刷新控件介绍
转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/24521483 下面App基本都有下拉刷新的功能,以前基本都使用XListView ...
- Simple Automated Backups for MongoDB Replica Sets
There are a bunch of different methods you can use to back up your MongoDB data, but if you want to ...