首页 > 代码库 > maven

maven

maven

  • maven
      • mvn install
      • pom 本地仓库设置
      • tomcat嵌入
      • 限制tomcat使用内存
      • mvn打jar包
      • idea创建maven项目时 慢
      • maven源

mvn install

mvn install:install-file -Dfile=/home/yks/GitHome/fullKis/client/target/client.jar -DgroupId=com.kis -DartifactId=client -Dversion=1.0-SNAPSHOT -Dpackaging=jar -DgeneratePom=true
mvn install:install-file -Dfile=/home/yks/GitHome/fullKis/server/target/server.jar -DgroupId=com.kis -DartifactId=server -Dversion=1.0-SNAPSHOT -Dpackaging=jar -DgeneratePom=true

pom 本地仓库设置

 <repositories>
 <repository>
 <id>nexus</id>
 <name>Nexus</name>
 <url>http://192.168.12.108:8081/nexus/content/groups/public/</url>
<layout>default</layout>
 <releases>
<enabled>true</enabled>
 </releases>
<snapshots>
 <enabled>true</enabled>
 </snapshots>
 </repository>
</repositories>

tomcat嵌入

 <plugin>
 <groupId>org.apache.tomcat.maven</groupId>
 <artifactId>tomcat7-maven-plugin</artifactId>
 <version>2.1</version>
 <configuration>
 <port>18081</port>
 <path>/</path>
 <uriEncoding>UTF-8</uriEncoding>
 <finalName>mgr</finalName>
 <server>tomcat7</server>
 </configuration>
 </plugin>

如果启动错误,请添加

<dependency>
 <groupId>javax.servlet</groupId>
 <artifactId>servlet-api</artifactId>
 <version>2.5</version>
 <scope>provided</scope>
 </dependency>

限制tomcat使用内存

在maven-runner中设置ovm
-Xms256m -Xmx512m

mvn打jar包

<plugin>
 <artifactId>maven-assembly-plugin</artifactId>
 <version>2.6</version>
 <configuration>
 <archive>
 <manifest>
 <mainClass>com.kis.App</mainClass>
 </manifest>
 </archive>
 <descriptorRefs>
 <descriptorRef>
 jar-with-dependencies
 </descriptorRef>
 </descriptorRefs>
 </configuration>
 </plugin>

idea创建maven项目时 慢

 setting->maven->runner->vm options:
 -DarchetypeCatalog=internal

maven源

 <mirror>
 <id>uk.maven.org</id>
 <mirrorOf>central</mirrorOf>
 <name>UK Central</name>
 <url>http://uk.maven.org/maven2</url>
 </mirror>

maven