zoukankan      html  css  js  c++  java
  • java开发常用命令

    • cd /d e:work2,更改至当前工作目录
      svnup.bat,批量更新所有项目
      @echo off
      for /D %%i in (.*) do (
      echo %%i
      svn up %%i
      )
      host.bat,本地临时更改域名解析
      notepad C:WindowsSystem32driversetchosts
      db.bat,方便连接内网数据库
      @echo off
      set db=default_db
      if ""%1"" == ""data"" goto data
      if ""%1"" == ""user"" goto user
      goto end
      :data
      set db=data_db
      goto end
      :user
      set db=user_db
      goto end
      :end
      mysql -h192.168.1.202 -uroot -p123456 -D%db%
    • mvn install
      项目管理通常使用mvn,组件类项目可以mvn install提交到本地依赖库后供其它项目引用,使用Nexus私服的配置为:${M2_HOME}/conf/settings.xml
      <mirrors><mirror>
      <id>nexus</id><name>local</name><url>http://localhost:8079/nexus/content/groups/public/</url>
        <mirrorOf>central</mirrorOf>
      </mirror></mirrors>
      如果要使用mvn deploy提交构件(而不是他人check out源码并mvn install),还需要配置:${M2_HOME}/conf/settings.xml
      <servers><server><id>nexus</id><username>admin</username><password>admin123</password></server></servers>
      以及项目配置pom.xml
      <distributionManagement>
       <repository><id>nexus</id><name>local</name><url>http://localhost:8079/nexus/content/groups/public/</url>
        </repository></distributionManagement>
    • mvn war:exploded
      网站项目通常不必打包war,发布时直接用WinSCP同步WebContent目录即可,命令mvn war:exploded可以构建完整的可直接被tomcat加载运行的WebContent目录,同时调试java和jsp都很方便。
      一种方式是直接编译输出class到WebContent/WEB-INF/classes目录(这时WEB-INF/lib会有jar包),然后用tomcat直接加载WebContent目录
      <build>
          <resources><resource><directory>src/main/resources</directory></resource></resources>
          <outputDirectory>WebContent/WEB-INF/classes</outputDirectory>
          <plugins>
              <plugin>
                  <artifactId>maven-war-plugin</artifactId>
                  <version>2.1.1</version>
                  <configuration>
                      <warSourceDirectory>WebContent</warSourceDirectory>
                      <webappDirectory>WebContent</webappDirectory>
                  </configuration>
              </plugin>
          </plugins>
      </build>
      另一种方式是编译输出到另外的目录(class+jsp+jar等),这时需要将WebContent也加入Source并输出到目标目录以便调试jsp(使用WebContentLink链接),同时WebContent/WEB-INF/classes链接到真正目标目录${target}/WebContent/WEB-INF/classes
      <properties>
          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
          <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
          <maven.compiler.source>1.7</maven.compiler.source>
          <maven.compiler.target>1.7</maven.compiler.target>
          <maven.test.skip>true</maven.test.skip>
          <targets.home>E:work2Serversweb</targets.home>
      </properties>
      <build>
          <directory>${targets.home}/${project.artifactId}/target</directory>
          <outputDirectory>${targets.home}/${project.artifactId}/WebContent/WEB-INF/classes</outputDirectory>
          <plugins>
              <plugin>
                  <artifactId>maven-war-plugin</artifactId>
                  <version>2.1.1</version>
                  <configuration>
                      <warSourceDirectory>WebContent</warSourceDirectory>
                      <webappDirectory>${targets.home}/${project.artifactId}/WebContent</webappDirectory>
                  </configuration>
              </plugin>
          </plugins>
      </build>
      调试运行或发布WebContent目录即可
      <Context docBase="E:work2ServerswebMyWebWebContent" path="/MyWeb"/>
    • 线上部署
      netstat -lntp,查看端口对应的进程

      ps -ef|grep java,查看运行的java项目

      nginx/sbin/nginx,运行nginx,重启-s reload,停止-s stop,配置vi nginx/conf/nginx.conf,日志tail -f nginx/logs/access.log
      resin/bin/resin.sh start,运行resin,重启restart,停止stop,配置vi resin/conf/resin.xml,日志tail -f resin/log/jvm-app-0.log
      ifconfig,查看IP地址;
      df -hlT,查看存储;top,查看运行状态
     




  • 相关阅读:
    [转]编译原理书籍推荐
    [转]让 Dreamweaver 支持 Emmet(原ZenCoding)
    [转]Zend Studio GitHub 使用教程
    [转]如何用EGit插件把github上的项目clone到eclipse
    [转]github更新自己fork的代码
    [转]少走弯路:学习编译原理的相关建议
    [转]关于计算机研究生报考方向的简要介绍
    [转]zend studio 安装git插件
    [转]如何在SAE上安装原版wordpress
    C语言博客作业02循环结构
  • 原文地址:https://www.cnblogs.com/xingqi/p/3480052.html
Copyright © 2011-2022 走看看