- 浏览: 44688 次
最新评论
MVN pom.xml 文件 打包生成war和类-class.jar
<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>MicroWagerSystem</groupId>
<artifactId>MicroWagerSystem</artifactId>
<version>trunk</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.glassfishDirectory>/home/javadev/glassfish3/glassfish</project.glassfishDirectory>
<project.glassfish.user>admin</project.glassfish.user>
<project.glassfish.password></project.glassfish.password>
<project.glassfish.domain>domain1</project.glassfish.domain>
<project.glassfish.adminPort>4848</project.glassfish.adminPort>
<project.glassfish.httpPort>9090</project.glassfish.httpPort>
<project.glassfish.httpsPort>8443</project.glassfish.httpsPort>
<project.glassfish.passwordFile>/home/javadev/glassfish3/glassfish/domains/domain1/config/domain-passwords</project.glassfish.passwordFile>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1.3</version>
</dependency>
<dependency>
<groupId>com.joyveb.lottery</groupId>
<artifactId>Router</artifactId>
<version>trunk</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.joyveb.lottery</groupId>
<artifactId>BizCommon</artifactId>
<type>jar</type>
<scope>compile</scope>
<version>trunk</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<!-- for debug -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.6.12</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2.2</version>
</dependency>
<!-- if you are creating a deployable file like a war you need to add the
aspectjrt library -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.6.12</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjlib</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>com.joyveb.lottery</groupId>
<artifactId>Notifier</artifactId>
<version>trunk</version>
<type>jar</type>
<classifier>classes</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.joyveb.lottery</groupId>
<artifactId>GtechSender</artifactId>
<version>trunk</version>
<type>jar</type>
<classifier>classes</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.joyveb.lottery</groupId>
<artifactId>Front</artifactId>
<version>trunk</version>
<type>jar</type>
<classifier>classes</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.joyveb.lottery</groupId>
<artifactId>StateEngine</artifactId>
<version>trunk</version>
<type>jar</type>
<classifier>classes</classifier>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<finalName>MicroWagerSystem</finalName>
<resources>
<resource>
<directory>src/main/java</directory>
</resource>
<resource>
<directory>src/main/resource</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</resource>
<resource>
<directory>src/keno/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/slto/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/pck3/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/trax/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/loto/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/pk4b/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/sync/keno/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/sync/slto/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/sync/pck3/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/sync/trax/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/sync/loto/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/sync/pk4b/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/java</source>
<source>src/gens/java</source>
<source>src/keno/java</source>
<source>src/slto/java</source>
<source>src/trax/java</source>
<source>src/pk4b/java</source>
<source>src/pck3/java</source>
<source>src/loto/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>utf-8</encoding>
<sources>
<source>src/main/java</source>
<source>src/main/resource</source>
<source>src/keno/java</source>
<source>src/slto/java</source>
<source>src/pck3/java</source>
<source>src/trax/java</source>
<source>src/loto/java</source>
<source>src/pk4b/java</source>
<source>src/sync/keno/java</source>
<source>src/sync/slto/java</source>
<source>src/sync/pck3/java</source>
<source>src/sync/trax/java</source>
<source>src/sync/loto/java</source>
<source>src/sync/pk4b/java</source>
</sources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>WebContent</directory>
</resource>
</webResources>
<attachClasses>true</attachClasses>
</configuration>
</plugin>
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.1</version>
<configuration>
<user>${project.glassfish.user}</user>
<adminPassword>${project.glassfish.password}</adminPassword>
<glassfishDirectory>${project.glassfishDirectory}</glassfishDirectory>
<passwordFile>${project.glassfish.passwordFile}</passwordFile>
<autoCreate>true</autoCreate>
<debug>true</debug>
<echo>false</echo>
<terse>true</terse>
<components>
<component>
<name>${project.build.finalName}</name>
<artifact>${project.build.directory}/${project.build.finalName}.war</artifact>
</component>
</components>
<domain>
<name>${project.glassfish.domain}</name>
<adminPort>${project.glassfish.adminPort}</adminPort>
<httpPort>${project.glassfish.httpPort}</httpPort>
<httpsPort>${project.glassfish.httpsPort}</httpsPort>
</domain>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<aspectDirectory>src/main/aspectj</aspectDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal> <!-- use this goal to weave all your main classes -->
<goal>test-compile</goal> <!-- use this goal to weave all your test classes -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.joyveb.lottery</groupId>
<artifactId>Front</artifactId>
<version>trunk</version>
<type>jar</type>
<classifier>classes</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.joyveb.lottery</groupId>
<artifactId>Notifier</artifactId>
<version>trunk</version>
<type>jar</type>
<classifier>classes</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.joyveb.lottery</groupId>
<artifactId>GtechSender</artifactId>
<version>trunk</version>
<type>jar</type>
<classifier>classes</classifier>
<scope>compile</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
相关推荐
在Maven的默认配置中,`target`目录下会生成一个`${project.artifactId}-${project.version}`格式的文件夹或JAR/WAR文件,包含了所有打包内容。如果将这个文件夹重命名为`package`,可能是为了满足特定的部署需求...
总结来说,将Spring Boot项目打包成WAR文件并在Tomcat中运行,主要是修改`pom.xml`配置,移除内置Tomcat,添加Servlet API依赖,创建适应Tomcat环境的启动类,然后通过Maven进行打包,最后将WAR文件部署到Tomcat的`...
本文将详细讲解如何正确配置Maven的pom.xml文件,以便将Spring Boot项目打包成war格式,这在需要部署到传统应用服务器(如Tomcat)时非常有用。 首先,我们需要理解Spring Boot的默认打包方式是jar,因为它内置了...
2. 打包阶段:将class文件打包成jar文件或war文件。 3. 测试阶段:执行测试代码,生成测试报告。 4. 部署阶段:将项目部署到服务器或Repository中。 依赖范围 ---------- Maven的依赖关系可以分为以下几个范围: ...
在pom.xml文件中,我们需要指定war打包方式,以便maven可以正确地生成war包。 ```xml <packaging>war ``` 2. 添加spring-boot-maven-plugin插件 添加spring-boot-maven-plugin插件可以帮助我们生成可执行的jar包。 `...
- `mvn package`:打包项目,如生成jar或war文件。 - `mvn install`:安装项目到本地仓库。 - `mvn deploy`:发布到远程仓库。 **9. Maven仓库** Maven依赖的jar库分为本地仓库(默认在用户主目录的`.m2\repository...
3. `mvn install`:此命令在`package`之后,将`target`目录下的打包文件安装到本地Maven仓库。这使得其他本地项目可以通过依赖管理直接引用这个项目,而无需再次编译。 在`maven-war-plugin`和`maven-install-...
在 Spring Boot 项目中,使用 Maven 打包文件成 JAR 包是非常常见的。下面是一个简单的示例: 在 `pom.xml` 文件中,添加以下配置: ```xml <packaging>jar <groupId>org.springframework.boot <artifactId>...
对于Web应用,最终的WAR包会将这些类文件打包到`WEB-INF/classes`目录。然而,如果我们希望在打包过程中直接将类文件放入`WebContent/WEB-INF/classes`,我们需要自定义Maven的配置。 要实现这一目标,我们需要修改...
- target:Maven生成的输出文件夹,包括编译后的class文件、打包的jar/war等。 3. Maven的命令行工具: - mvn clean:清理目标目录,删除已生成的文件。 - mvn compile:编译源代码。 - mvn test:运行单元测试...
4. 创建打包文件:运行`mvn package`,Maven会根据项目打包类型(如jar、war等)生成相应格式的文件。 5. 安装到本地仓库:如果需要在本地开发环境中使用,可以运行`mvn install`。 6. 部署到远程仓库:在生产环境...
- 对于Maven项目,确保先执行`mvn clean install`命令进行编译和打包。 - 将WAR文件部署到Tomcat服务器上,并启动服务。 通过以上步骤,我们可以成功搭建起一个基于Maven的SSM框架项目。在实际开发过程中,还需要...
File -> Project Structure -> Artifacts,新建JAR或WAR,选择主类和打包内容,然后Build -> Build Artifacts。 - **Maven**: 在pom.xml中配置maven-jar-plugin,例如: ```xml <groupId>org.apache....
最后,执行`mvn package`命令,Maven会根据`pom.xml`中的配置打包项目,并生成包含所有依赖的JAR文件。在上述例子中,这个JAR文件会包含Dubbo服务接口和其依赖的库,使得我们可以轻松地部署和运行服务。 在实际开发...
标题“repository.zip”暗示了这是一个与Java开发相关的资源包,特别是使用Maven进行构建和打包的一个Web应用程序。在Eclipse这种流行的Java集成开发环境中,开发者经常需要管理各种库和依赖,以便于项目的顺利进行...
同时,Maven的`maven-jar-plugin`插件可以用来配置生成的JAR文件,比如设置manifest文件,以便包含Spring的启动类: ```xml <groupId>org.apache.maven.plugins <artifactId>maven-jar-plugin ...
通过以上步骤,你就可以使用Maven成功地编译和打包一个Java项目为JAR文件。确保你的环境中已经安装了Maven,并且配置了正确的Maven环境变量,然后按照上述方法操作即可。记住,Maven的强大在于它的标准化和自动化,...
1. **添加IboxDB依赖**:在pom.xml文件中,你需要找到`<dependencies>`标签,然后在其中添加IboxDB的依赖项,如下所示: ```xml <groupId>com.ilearn</groupId> <artifactId>iboxdb 版本号(请根据实际更新) ...
通过设置pom.xml文件,Maven可以自动完成打包操作,如`mvn package`命令会生成JAR或WAR。 5. **MyWindow**: 压缩包内的`MyWindow`很可能是一个Java窗体类,通常用于创建图形用户界面(GUI)。在Java中,我们可以...