maven-day01

阿里云远程仓库

<mirror>
          <id>alimaven</id>
          <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
          <mirrorOf>central</mirrorOf>        
 </mirror>

如何使用maven建一个web3.0的项目

1、 在项目的.setting文件夹中编辑org.eclipse.wst.common.project.facet.core.xml文件,将 的2.3改为3.0,随后右键项目,选择maven->update project ,之后会出现红叉,不用担心,接着下一步。

2、右击项目,找到properties->project facets,将Dynamic web Module改为3.0,而下面的java版本也改为相应的。

3、在web.xml文件中的代替,其中版本要相互对应,最后再update project,红叉就消失了,版本就变为3.0了。

<?xml version="1.0" encoding="UTF-8"?>  
<web-app version="3.0"  
    xmlns="http://java.sun.com/xml/ns/javaee"  
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee  
  http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

 如果觉得每次update project项目JRE System Lib都会变化,那么,可以再pom.xml的上加上
 

<plugins>
            <!-- 编译的时候使用JDK7和UTF8编码 ,-->
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <!-- <version>3.0</version> -->
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>

            <!-- 编译jar包 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <addMavenDescriptor>false</addMavenDescriptor>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
 </plugins>

让maven一开始就构建指定的java版本,一劳永逸,在maven的settings中设置

 <profile>  
        <id>jdk-1.7</id>  
         <activation>  
              <activeByDefault>true</activeByDefault>  
              <jdk>1.7</jdk>  
          </activation>  
        <properties>  
        <maven.compiler.source>1.7</maven.compiler.source>  
        <maven.compiler.target>1.7</maven.compiler.target>  
        <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>  
        </properties>  
    </profile>

mybatis在配置文件中自定义id

<insert id="insert" parameterType="dept">
        <selectKey keyProperty="id" resultType="String" order="BEFORE">
            select replace(uuid(),'-','') from dual
        </selectKey>
        insert into 
        t_dept(id,dept_name,address,create_time)
        values(#{id},#{deptName},#{address},#{createTime})
</insert>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

发疯的man

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值