使用maven为选定的包创建jar文件

时间:2013-12-03 06:57:30

标签: maven

我要求为选定的包生成jar文件我是maven的新手我能够为 src 文件夹创建jar但无法使用和标记。我花了将近3天我还没有得到了解决方案。请通过提供良好的解决方案或porm.xml文件来帮助我

先谢谢, 问候 西。

1 个答案:

答案 0 :(得分:0)

<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>
	<groupId>com.apmc.sphbn</groupId>
	<artifactId>APMC</artifactId>
	<packaging>war</packaging>
	<version>1.0-SNAPSHOT</version>
	<name>APMC</name>
	<url>http://maven.apache.org</url>
	

 <properties>
		<spring.version>4.0.5.RELEASE</spring.version>
		<hibernate.version>4.3.5.Final</hibernate.version>
		<log4j.version>1.2.17</log4j.version>
		<jdk.version>1.8</jdk.version>
		<context.path>APMC</context.path>
		
	</properties>
	
	<build>
		<finalName>${pom.artifactId}</finalName>

		<plugins>
			<!-- Maven compiler plugin -->
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>${jdk.version}</source>
					<target>${jdk.version}</target>
				</configuration>
			</plugin>
		</plugins>
	</build>
	<dependencies>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>${log4j.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-orm</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-entitymanager</artifactId>
			<version>${hibernate.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>jstl</groupId>
			<artifactId>jstl</artifactId>
			<version>1.2</version>
		</dependency>
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>5.1.6</version>
		</dependency>
		
		<dependency>
    		<groupId>javax.validation</groupId>
    		<artifactId>validation-api</artifactId>
    		<version>1.1.0.Final</version>
		</dependency>

		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-validator</artifactId>
			<version>5.0.1.Final</version>
		</dependency>
		
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.5</version>
		</dependency>
		
		<dependency>
        	<groupId>javax.servlet.jsp</groupId>
        	<artifactId>jsp-api</artifactId>
        	<version>2.1</version>
        	<scope>provided</scope>
    	</dependency>
    	
    	<dependency>
    		<groupId>taglibs</groupId>
    		<artifactId>standard</artifactId>
    		<version>1.1.2</version>
   		</dependency>
		    	
		<dependency>
			<groupId>org.json</groupId>
			<artifactId>json</artifactId>
			<version>20141113</version>
		</dependency>
		  	
		<!-- Spring Security -->  
		<dependency>  
		    <groupId>org.springframework.security</groupId>
			<artifactId>spring-security-core</artifactId>
			<version>3.1.4.RELEASE</version>
		</dependency>
		
		<dependency>
			<groupId>org.springframework.security</groupId>
			<artifactId>spring-security-web</artifactId>
			<version>3.2.1.RELEASE</version>
		</dependency>
		
		<dependency>
			<groupId>org.springframework.security</groupId>
			<artifactId>spring-security-config</artifactId>
			<version>3.2.1.RELEASE</version>
		</dependency>
		
	   <dependency>
		 <groupId>org.springframework.security</groupId>
		 <artifactId>spring-security-taglibs</artifactId>
		  <version>3.1.4.RELEASE</version>
	   </dependency>
		    	
	   <dependency>
		<groupId>org.springframework</groupId>
		<artifactId>spring-framework-bom</artifactId>
		<version>4.1.6.RELEASE</version>
		<type>pom</type>
		<scope>import</scope>
	  </dependency>
	
		<!-- JSON Object -->
		<dependency>
			<groupId>org.json</groupId>
			<artifactId>json</artifactId>
			<version>20141113</version>
		</dependency>
		
		<!-- Jackson Object -->
		<dependency>
			<groupId>org.codehaus.jackson</groupId>
			<artifactId>jackson-mapper-asl</artifactId>
			<version>1.9.13</version>
		</dependency>
		
		</dependencies>
</project>