pomxml怎么配置
① pom.xml中怎么配置hibernate3.3
把xml中配置改了,LocalSessionFactoryBean是配置xml的方式,AnnotationSessionFactoryBean是注解的方式。把LocalSessionFactoryBean改成AnnotationSessionFactoryBean:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="packagesToScan">
<list>
<value>这里是你要映射的实体类的包,如:com.hksoft.entity</value>
</list>
</property>
</bean>
② 如何配置pom.xml用maven打包java工程
1,生成3个目录/lib,/conf,/bin目录
2,把所有的jar目录编译、拷贝到/lib目录(包括maven的jar包和lib目录下的jar,以及编译的jar包)
3,把所有的启动脚本从工程根目录拷贝到/bin目录
4,把所有的配置文件从src/main/resources拷贝到/conf
pom.xml 配置
<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>test</groupId>
<artifactId>test.common</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>test.common</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- 这里省略n行 -->
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<!-- 把src/main/resources目录下所有的文件拷贝到conf目录中 -->
<resource>
<directory>src/main/resources</directory>
<targetPath>${project.build.directory}/conf</targetPath>
</resource>
<!-- 把lib目录下所有的文件拷贝到lib目录中
(可能有些jar包没有办法在maven中找到,需要放在lib目录中) -->
<resource>
<directory>lib</directory>
<targetPath>${project.build.directory}/lib</targetPath>
</resource>
<!-- 把放在根目录下的脚本文件.sh,.bat拷贝到bin目录中 -->
<resource>
<directory>.</directory>
<includes>
<include>**/*.sh</include>
<include>**/*.bat</include>
</includes>
<targetPath>${project.build.directory}/bin</targetPath>
</resource>
</resources>
<plugins>
<!-- 用于编译的plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<fork>true</fork>
<defaultLibBundleDir>lib</defaultLibBundleDir>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
<!-- 如果配置了JAVA_HOME,下面应该可以不用配 -->
<executable>C:\Program Files (x86)\Java\jdk1.8.0_91\bin\javac.exe</executable>
</configuration>
</plugin>
<!-- 用于生成jar包的plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<!-- 把生成的jar包放在lib目录下(和其他所有jar包一起) -->
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
<excludes>
<!-- 排除掉一些文件,不要放到jar包中,
这里是为了排除掉src/main/resources中的文件(它们应该放到conf目录)
这里只能指定要排除的目标文件,而不能指定源文件,虽然不够完美,但是基本能达到目的。 -->
<exclude>*.xml</exclude>
<exclude>*.properties</exclude>
</excludes>
</configuration>
</plugin>
<!-- 用于拷贝maven依赖的plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>-dependencies</id>
<phase>package</phase>
<goals>
<goal>-dependencies</goal>
</goals>
<configuration>
<!-- 把依赖的所有maven jar包拷贝到lib目录中(这样所有的jar包都在lib目录中) -->
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- 用于拷贝resource的plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- 配置生成源代码jar的plugin -->
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<configuration>
<attach>true</attach>
<encoding>UTF-8</encoding>
<!-- 配置源代码jar文件的存放路径,和其他jar文件一起放在lib目录 -->
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
然后执行maven package打包。如果是eclipse,在Project Explorer-> Run As –> Maven Build… –>在Goals中输入package,点Run进行编译。
③ 如何配置pom.xml用maven打包java工程
最近由于项目需要,研究了一下maven的打包,项目要做到
1,生成3个目录/lib,/conf,/bin目录
2,把所有的jar目录编译、拷贝到/lib目录(包括maven的jar包和lib目录下的jar,以及编译的jar包)
3,把所有的启动脚本从工程根目录拷贝到/bin目录
4,把所有的配置文件从src/main/resources拷贝到/conf
VX众号:Java6359
④ spring boot mybatis 整合pom.xml怎么配置
给你完整的pom.xml,还给了你热部署的依赖了
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.5.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- SpringBoot test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- Spring-Mybatis -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.0</version>
</dependency>
<!-- Mysql -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- Add typical dependencies for a web application -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- springboot热部署 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<scope>true</scope>
</dependency>
</dependencies>
<!-- Package as an executable jar -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
⑤ 如何配置pom.xml用maven打包java工程
<groupId>per.summer.MyBatis</groupId>
<artifactId>firsteBybatis</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
这个是打包成jar
<groupId>per.summer.mybatis</groupId>
<artifactId>ssm-maven</artifactId>
<packaging>war</packaging>
这个是打包成war
GroupID是项目组织唯一的标识符,实际对应JAVA的包的结构,是main目录里java的目录结构。
ArtifactID就是项目的唯一的标识符,实际对应项目的名称,就是项目根目录的名称。根据你自己的来就是了
⑥ 如何配置pom.xml用maven打包java工程
<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.common</groupId>
<artifactId>dkcjDemo</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>dkcjDemo</name>
<url>http://maven.apache.org</url>
<!-- 用来设置版本号 -->
<properties>
<srping.version>4.0.2.RELEASE</srping.version>
<mybatis.version>3.2.8</mybatis.version>
<slf4j.version>1.7.12</slf4j.version>
<log4j.version>1.2.17</log4j.version>
<shiro.version>1.2.3</shiro.version>
</properties>
<!-- 用到的jar包 -->
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-xml-provider</artifactId>
<version>2.5.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.5.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.5.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.5.2</version>
</dependency>
<!-- Apache shiro -->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-cas</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
</dependency>
<!-- 单元测试 -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<!-- 表示开发的时候引入,发布的时候不会加载此包 -->
<scope>test</scope>
</dependency>
<!-- java ee包 -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
<!-- spring框架包 start -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${srping.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${srping.version}</version>
</dependency>
<!-- spring框架包 end -->
<!-- mybatis框架包 start -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.2.2</version>
</dependency>
<!-- mybatis框架包 end -->
<!-- 数据库驱动 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.35</version>
</dependency>
<!-- 导入dbcp的jar包,用来在applicationContext.xml中配置数据库 -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<!-- jstl标签类 -->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<!-- log start -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- log END -->
<!-- Json -->
<!-- 格式化对象,方便输出日志 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.6</version>
</dependency>
<!-- <dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency> -->
<!-- 上传组件包 start -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<!-- 上传组件包 end -->
<!-- AL相关添加 -->
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.8</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
<!-- AL相关添加 -->
<!-- ftp -->
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.3</version>
</dependency>
</dependencies>
<build>
<finalName>dkcjDemo</finalName>
<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>
</configuration>
</plugin>
</plugins>
</build>
</project>
⑦ JAVA Maven install 方式导本地Jar库在pom。xml中怎么具体配置
<dependency>
<groupId>org.uddi</groupId>
<artifactId>antlr-2.7.6</artifactId>
<version>0.9.2</version>
</dependency>
这样就可以了,pom不会挑的,只要你导入到本地库,就可以被依赖到
⑧ maven怎么进行pom.xml的依赖配置
所有的maven project都有一个pom.xml文件,
打开pom.xml,找到dependency tag:<dependencies></dependencies>所在的位置;
然后到 maven repository中找到你所需要的包;
进入jar包,点选相应的版本,然后页面中就会有加入maven project的dependency,类似下面的内容:
[html] view plain
<dependency>
<groupId>org.broadleafcommerce</groupId>
<artifactId>broadleaf-framework</artifactId>
<version>3.0.12-GA</version>
</dependency>
将这个语句片拷下来,放到你的project中的pom.xml文件的<dependencies></dependencies>中。
保存pom.xml文件,project就会自动build,将所需要的jar包导入到项目中,在Maven Dependencies目录下。
⑨ 连接zookeeper时pom.xml怎么配置
在自己主机上面安装zookeeper,然后就可以写代码了,我们计划是将接口底层跟上层相互分离;
consumer.xml:
复制代码
<?xml version="1.0" encoding="UTF-8"?>
<beansgframework.org/schema/beans"
xmlns:xsi="httporg/20 www.cshangzj.com 01/XMLSchema-instance"
xmlns:bbo="httpbatech.com/schema/bbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http:/framework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/bbo
http://code.alibabatech.com/schema/bbo/bbo.xsd
">
<!-- 消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 -->
<bbo:application name="consumer-of-helloworld-app" />
<bbo:registry
address="ip:port"
protocol="zookeeper" />
<!-- 生成远程服务代理,可以和本地bean一样使用demoService -->
<bbo:reference id="demoService" interface="net.datafans.exercise.bbo.DemoService" />
</beans>
复制代码
provider.xml
复制代码
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:bbo="http://code.alibabatech.com/schema/bbo"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
a/beans/spring-beans.xsd
http:/om/schema/bbo
http://code.alibaba
<!-- 提供方应用信息,用于计算依赖关系 -->
<bbo:application name="zookeeper-registry" />
<!-- 当前应用信息配置 -->
⑩ 如何在maven的pom.xml中配置jetty插件
在maven的pom.xml中添加如下内容即可:
<build>
<plugins>
<!--jetty插件,设定端口与contextpath-->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<jvmArgs>-XX:PermSize=512m-XX:MaxPermSize=512m
-XX:+CMSPermGenSweepingEnabled
-XX:+CMSClassUnloadingEnabled</jvmArgs>
<reload>manual</reload>
<webAppConfig>
<contextPath>/test</contextPath>//注释一此处为项目的上下文路径
</webAppConfig>
<connectors>
<connectorimplementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<port>8088</port>//注释二此处配置了访问的端口号
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
</configuration>
</plugin>
</plugins>
</build>