maven在开发的过程中可以进行项目的打包。下面来看例子:
<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>hw.hlatform.secg</groupId> <artifactId>secg-parent</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../secg-parent/pom.xml</relativePath> </parent> <artifactId>IHos-Api</artifactId> <packaging>war</packaging> <name>IHos-Api Maven Webapp</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> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> </dependency> <!-- https://mvnrepository.com/artifact/commons-logging/commons-logging --> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </dependency> <dependency> <groupId>org.glassfish.gmbal</groupId> <artifactId>gmbal-api-only</artifactId> <version>3.2.0-b003</version> </dependency> <dependency> <groupId>org.glassfish.ha</groupId> <artifactId>ha-api</artifactId> <version>3.1.9</version> </dependency> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.2.12</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-core</artifactId> <version>2.2.11</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId> <version>2.2.11</version> </dependency> <!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-xjc --> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-xjc</artifactId> <version>2.2.11</version> </dependency> <!-- https://mvnrepository.com/artifact/javax.xml.ws/jaxws-api --> <dependency> <groupId>javax.xml.ws</groupId> <artifactId>jaxws-api</artifactId> <version>2.2.11</version> </dependency> <!-- https://mvnrepository.com/artifact/com.sun.xml.ws/jaxws-rt --> <dependency> <groupId>com.sun.xml.ws</groupId> <artifactId>jaxws-rt</artifactId> <version>2.2.10</version> <type>pom</type> </dependency> <!-- https://mvnrepository.com/artifact/com.sun.xml.ws/jaxws-tools --> <dependency> <groupId>com.sun.xml.ws</groupId> <artifactId>jaxws-tools</artifactId> <version>2.2.10</version> <type>pom</type> </dependency> <!-- https://mvnrepository.com/artifact/org.glassfish.external/management-api --> <dependency> <groupId>org.glassfish.external</groupId> <artifactId>management-api</artifactId> <version>3.2.1-b002</version> </dependency> <!-- https://mvnrepository.com/artifact/org.jvnet.staxex/stax-ex --> <dependency> <groupId>org.jvnet.staxex</groupId> <artifactId>stax-ex</artifactId> <version>1.7.7</version> </dependency> <!-- https://mvnrepository.com/artifact/org.codehaus.woodstox/stax2-api --> <dependency> <groupId>org.codehaus.woodstox</groupId> <artifactId>stax2-api</artifactId> <version>4.0.0</version> </dependency> <!-- https://mvnrepository.com/artifact/com.sun.xml.stream.buffer/streambuffer --> <dependency> <groupId>com.sun.xml.stream.buffer</groupId> <artifactId>streambuffer</artifactId> <version>1.5.3</version> </dependency> <!-- 公共parent上的jar --> <!-- http://mvnrepository.com/artifact/org.springframework/spring-orm --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <!-- http://mvnrepository.com/artifact/org.springframework/spring-context --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> </dependency> <!-- http://mvnrepository.com/artifact/org.springframework/spring-orm --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> </dependency> <!-- http://mvnrepository.com/artifact/org.springframework/spring-orm --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>3.2.1.RELEASE</version> </dependency> <!-- http://mvnrepository.com/artifact/org.springframework/spring-oxm --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-oxm</artifactId> </dependency> <!-- http://mvnrepository.com/artifact/org.springframework/spring-tx --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>3.2.1.RELEASE</version> </dependency> <!-- http://mvnrepository.com/artifact/org.springframework/spring-jdbc --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>3.2.1.RELEASE</version> </dependency> <!-- http://mvnrepository.com/artifact/org.springframework/spring-webmvc --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>3.2.1.RELEASE</version> </dependency> <!-- https://mvnrepository.com/artifact/org.springframework/spring-aop --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>4.3.2.RELEASE</version> </dependency> <!-- https://mvnrepository.com/artifact/org.springframework/spring-context-support --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>4.3.2.RELEASE</version> </dependency> <!-- http://mvnrepository.com/artifact/org.springframework/spring-test --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> </dependency> <!-- https://mvnrepository.com/artifact/org.springframework/spring-core --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>4.3.2.RELEASE</version> </dependency> <dependency> <groupId>com.caucho</groupId> <artifactId>hessian</artifactId> <version>4.0.38</version> </dependency> <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis --> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>3.4.1</version> </dependency> <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis-spring --> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis-spring</artifactId> <version>1.3.0</version> </dependency> <!-- https://mvnrepository.com/artifact/org.mybatis.generator/mybatis-generator-core --> <dependency> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-core</artifactId> <version>1.3.4</version> </dependency> <!-- 导入java ee jar 包 --> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>7.0</version> </dependency> <!-- 导入dbcp的jar包,用来在applicationContext.xml中配置数据库 --> <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>1.2.2</version> </dependency> <!-- JSTL标签类 --> <dependency> <groupId>jstl</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <!-- 日志 --> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> </dependency> <!--格式化对象,方便输出日志 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.16</version> </dependency> <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.21</version> </dependency> <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </dependency> <!-- 映入JSON --> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> <version>1.9.13</version> </dependency> <!-- 上传组件包 --> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.3.1</version> </dependency> <!-- https://mvnrepository.com/artifact/commons-io/commons-io --> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.5</version> </dependency> <!-- https://mvnrepository.com/artifact/commons-codec/commons-codec --> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>1.10</version> </dependency> <dependency> <groupId>hw.hlatform.secg</groupId> <artifactId>secg-utils</artifactId> </dependency> <dependency> <groupId>hw.hlatform.secg</groupId> <artifactId>secg-pubilcinc</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> </dependencies> <build> <finalName>IHos-Api</finalName> <plugins> <!-- 打成war包 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.2</version> <configuration> <warName>IHos-Api</warName> </configuration> </plugin> <!-- 打成源码jar包 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> </plugin> <!-- jetty服务器 --> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <configuration> <scanIntervalSeconds>10</scanIntervalSeconds> <contextXml>${project.basedir}/src/test/java/jetty-context.xml</contextXml>//在没有配置事务的时候每次启动jetty需要检查事务,很慢,此配置可以忽略事务的检查 <webApp> <contextPath>/</contextPath> </webApp> <connectors> <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector"> <port>8082</port> <maxIdleTime>60000</maxIdleTime> </connector> </connectors> </configuration> </plugin> </plugins> <!-- 目录各级的xml打包 --> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> </resource> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.xml</include> <include>**/*.properties</include> </includes> </resource> </resources> </build> </project>
相关推荐
最后,`jetty-env.xml`文件用于配置Jetty环境变量,比如JNDI资源。例如,如果你需要配置数据源,可以在`jetty-env.xml`中定义: ```xml <New id="dataSource" class="org.eclipse.jetty.plus.jndi.Resource"> ...
在IT行业中,构建Web服务是常见的任务之一,而 Jersey 和 Jetty 框架的结合使用可以帮助我们快速、高效地实现这一目标。本教程将详细讲解如何利用这两个强大的工具搭建一个支持文件上传和下载功能的Web应用。 首先...
一旦开发完成,可以使用Maven打包应用为可执行的JAR或WAR文件,然后将其部署到服务器上,如Tomcat或Jetty,或者使用Docker容器化部署。 通过以上步骤,我们可以利用Maven成功地搭建一个RESTful服务。这个过程展示...
本文将详细讲解如何正确配置Maven的pom.xml文件,以便将Spring Boot项目打包成war格式,这在需要部署到传统应用服务器(如Tomcat)时非常有用。 首先,我们需要理解Spring Boot的默认打包方式是jar,因为它内置了...
`E3.Resource.properties`是E3.Resource的配置文件,用于定义资源加载的规则和行为。这里可以设定资源的路径、压缩策略、合并策略、缓存策略等。例如: ``` resource.base.path=/static/ resource.compress=true ...
`project_resource`目录可能包含了项目的资源文件,如配置文件、静态资源等。`.idea`目录是IDE的项目配置,包含了一些元数据和设置。`target`目录则是Maven构建后的输出目录,包含了编译后的类文件、打包的JAR或WAR...
在UAP Resource中,可能会包含服务器配置(如Tomcat或Jetty)、数据库连接配置(如JDBC配置)、日志配置(如Log4j或Logback)以及各种应用的配置文件(如application.properties或application.yml)。理解并正确配置...
- `pom.xml`:Maven的项目配置文件,管理项目的依赖。 **二、添加依赖** 在`pom.xml`中,我们需要添加SpringMVC、MyBatis以及它们各自依赖的库。例如: ```xml <groupId>org.springframework <artifactId>...
3. **配置Maven**:确保项目已经配置了Maven,可以在`File -> Project Structure`中检查或配置Maven。 4. **构建WAR包**: - 在IntelliJ IDEA的终端窗口输入`mvn clean package`命令进行构建。 - 构建完成后,可以...
2. 支持多种资源:JOTM可以与各种JDBC驱动、JMS提供者以及其他遵循XAResource接口的资源配合使用,确保事务在这些资源之间的一致性。 3. 高度可配置:通过配置文件,用户可以自定义事务超时、回滚规则、恢复策略等...
首先,我们需要一个标准的Java项目结构,通常包括src/main/java(源代码)、src/main/resources(资源文件)以及pom.xml(Maven项目配置文件)或build.gradle(Gradle项目配置文件)。 1. **创建项目结构**:使用...
- Vue项目通过Webpack打包,生成静态资源文件。 - 将这些资源文件部署到Spring Boot应用的静态资源目录下。 - 使用Spring Boot内置的HTTP服务器启动应用,前端资源将自动被服务。 【开发流程与最佳实践】 1. **...
- **配置Mybatis**:在application.properties或yaml文件中配置数据源、Mybatis的mapper文件位置、事务管理等。 - **创建Mapper接口**:定义与数据库交互的接口,每个方法对应一个SQL语句。 - **编写Mapper XML...
- **使用 Vue CLI 打包构建**:Vue CLI 提供了一套构建工具,可以将前端应用打包成静态资源文件,便于部署到 Web 服务器。 #### 三、集成和联调 **1. 联调后端接口** - **确保前端能够正确调用后端 API**:在...
当客户端(如浏览器)发送文件时,会将多个部分(包括文本字段和文件)打包在一个请求中。 3. **jersey-server-fileUpload示例的运行** 要运行这个示例,首先确保你已经安装了Maven。在命令行中导航到项目目录,...
Spring Boot推荐使用CORS(Cross-Origin Resource Sharing,跨源资源共享)来解决跨域问题。 - **CORS实现方式**:在Spring Boot中,可以通过`@CrossOrigin`注解来配置CORS。例如,可以在控制器类或具体的方法上...
通常,如果你的项目是Maven工程,可以在pom.xml文件中添加以下依赖: ```xml <groupId>org.glassfish.jersey.containers <artifactId>jersey-container-servlet-core <version>YOUR_JERSEY_VERSION ``` 配置...
改变应用程序外部配置文件的位置 iii. 63.3. 使用'short'命令行参数 iv. 63.4. 使用YAML配置外部属性 v. 63.5. 设置生效的Spring profiles vi. 63.6. 根据环境改变配置 vii. 63.7. 发现外部属性的内置选项 iii. 64....
创建Spring的配置文件(如:applicationContext.xml),定义Reslet应用程序和资源的bean。例如: ```xml <bean id="defaultServer" class="org.restlet.ext.jetty.Server"> <value>org.restlet...