首页

在eclipse中常用的maven的打包发布及运行tomcat插件服务命令

标签:maven-tomcat,Maven Build插件,install,javagent,run-war,tomcat:run,-Dmaven.tomcat.port,clean package,settings.xml     发布时间:2017-03-28   

关于在eclipse中使用maven常用的执行发布及运行tomcat插件服务的命令:maven clean package  install  tomcat:run等等

clean package@b@@b@clean install@b@@b@tomcat:run -Dmaven.tomcat.port=8086@b@@b@tomcat:run-war -Dmaven.tomcat.port=8088@b@@b@-Dsolr.solr.home=D:\NJ\workspace\woopa-solr\solr-data@b@ @b@@b@-javagent:F:\NJ\jar\repository\org\springframework\spring-agent\2.5.6.SEC02\spring-agent-2.5.6.SEC02.jar  -server -Xms800m -Xmx800m -XX:PermSize=64M -XX:MaxNewSize=256m -XX:MaxPermSize=128m@b@@b@@b@JAVA_OPTS="-server -Xms800m -Xmx800m -XX:PermSize=64M -XX:MaxNewSize=256m -XX:MaxPermSize=128m"

配置setting.xml模板

<?xml version="1.0" encoding="UTF-8"?>@b@@b@<!--@b@Licensed to the Apache Software Foundation (ASF) under one@b@or more contributor license agreements.  See the NOTICE file@b@distributed with this work for additional information@b@regarding copyright ownership.  The ASF licenses this file@b@to you under the Apache License, Version 2.0 (the@b@"License"); you may not use this file except in compliance@b@with the License.  You may obtain a copy of the License at@b@@b@    http://www.apache.org/licenses/LICENSE-2.0@b@@b@Unless required by applicable law or agreed to in writing,@b@software distributed under the License is distributed on an@b@"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY@b@KIND, either express or implied.  See the License for the@b@specific language governing permissions and limitations@b@under the License.@b@-->@b@@b@<!--@b@ | This is the configuration file for Maven. It can be specified at two levels:@b@ |@b@ |  1. User Level. This settings.xml file provides configuration for a single user,@b@ |                 and is normally provided in ${user.home}/.m2/settings.xml.@b@ |@b@ |                 NOTE: This location can be overridden with the CLI option:@b@ |@b@ |                 -s /path/to/user/settings.xml@b@ |@b@ |  2. Global Level. This settings.xml file provides configuration for all Maven@b@ |                 users on a machine (assuming they're all using the same Maven@b@ |                 installation). It's normally provided in@b@ |                 ${maven.home}/conf/settings.xml.@b@ |@b@ |                 NOTE: This location can be overridden with the CLI option:@b@ |@b@ |                 -gs /path/to/global/settings.xml@b@ |@b@ | The sections in this sample file are intended to give you a running start at@b@ | getting the most out of your Maven installation. Where appropriate, the default@b@ | values (values used when the setting is not specified) are provided.@b@ |@b@ |-->@b@<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"@b@          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"@b@          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">@b@  <!-- localRepository@b@   | The path to the local repository maven will use to store artifacts.@b@   |@b@   | Default: ~/.m2/repository@b@   @b@    <localRepository>/path/to/local/repo</localRepository>@b@    <localRepository>\\172.168.1.8\网盘\Repository\Jar</localRepository>@b@    <localRepository>\\172.168.1.8\网盘\Repository\Jar</localRepository>@b@    <localRepository>\\139.196.30.182\gx\Repositories\Jar</localRepository>@b@  @b@  -->@b@  @b@  <localRepository>C:\Users\nijun\.m2\repository</localRepository>@b@@b@  <!-- interactiveMode@b@   | This will determine whether maven prompts you when it needs input. If set to false,@b@   | maven will use a sensible default value, perhaps based on some other setting, for@b@   | the parameter in question.@b@   |@b@   | Default: true@b@  <interactiveMode>true</interactiveMode>@b@  -->@b@@b@  <!-- offline@b@   | Determines whether maven should attempt to connect to the network when executing a build.@b@   | This will have an effect on artifact downloads, artifact deployment, and others.@b@   |@b@   | Default: false@b@  <offline>false</offline>@b@  -->@b@ <offline>false</offline>@b@@b@  <!-- pluginGroups@b@   | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.@b@   | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers@b@   | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.@b@   |-->@b@  <pluginGroups>@b@    <!-- pluginGroup@b@     | Specifies a further group identifier to use for plugin lookup.@b@    <pluginGroup>com.your.plugins</pluginGroup>@b@    -->@b@  </pluginGroups>@b@@b@  <!-- proxies@b@   | This is a list of proxies which can be used on this machine to connect to the network.@b@   | Unless otherwise specified (by system property or command-line switch), the first proxy@b@   | specification in this list marked as active will be used.@b@   |@b@  <proxies>@b@ <proxy>@b@      <id>optional</id>@b@      <active>true</active>@b@      <protocol>http</protocol>@b@      <username></username>@b@      <password></password>@b@      <host>192.168.3.162</host>@b@      <port>51999</port>@b@      <nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>@b@    </proxy>@b@  </proxies>-->@b@@b@  <!-- servers@b@   | This is a list of authentication profiles, keyed by the server-id used within the system.@b@   | Authentication profiles can be used whenever maven must make a connection to a remote server.@b@   |-->@b@  <servers>@b@    <!-- server@b@     | Specifies the authentication information to use when connecting to a particular server, identified by@b@     | a unique name within the system (referred to by the 'id' attribute below).@b@     |@b@     | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are@b@     |       used together.@b@     |@b@    <server>@b@      <id>deploymentRepo</id>@b@      <username>repouser</username>@b@      <password>repopwd</password>@b@    </server>@b@    -->@b@@b@    <!-- Another sample, using keys to authenticate.@b@    <server>@b@      <id>siteServer</id>@b@      <privateKey>/path/to/private/key</privateKey>@b@      <passphrase>optional; leave empty if not used.</passphrase>@b@    </server>@b@    -->@b@	@b@	<server>@b@		<id>central</id>@b@		<username>admin</username>@b@		<password>admin123</password>@b@	</server>@b@	@b@  </servers>@b@@b@  <!-- mirrors@b@   | This is a list of mirrors to be used in downloading artifacts from remote repositories.@b@   |@b@   | It works like this: a POM may declare a repository to use in resolving certain artifacts.@b@   | However, this repository may have problems with heavy traffic at times, so people have mirrored@b@   | it to several places.@b@   |@b@   | That repository definition will have a unique id, so we can create a mirror reference for that@b@   | repository, to be used as an alternate download site. The mirror site will be the preferred@b@   | server for that repository.@b@   |-->@b@  <mirrors>@b@    <!-- mirror@b@     | Specifies a repository mirror site to use instead of a given repository. The repository that@b@     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used@b@     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.@b@     |@b@    <mirror>@b@      <id>mirrorId</id>@b@      <mirrorOf>repositoryId</mirrorOf>@b@      <name>Human Readable Name for this Mirror.</name>@b@      <url>http://my.repository.com/repo/path</url>@b@    </mirror>@b@     -->@b@	  @b@		<mirror>@b@		  <id>public</id>@b@		  <name>public</name>@b@		  <url>http://192.168.1.201:8081/nexus/content/groups/public</url>@b@		  <mirrorOf>*</mirrorOf>@b@		</mirror>@b@	@b@  </mirrors>@b@@b@  <!-- profiles@b@   | This is a list of profiles which can be activated in a variety of ways, and which can modify@b@   | the build process. Profiles provided in the settings.xml are intended to provide local machine-@b@   | specific paths and repository locations which allow the build to work in the local environment.@b@   |@b@   | For example, if you have an integration testing plugin - like cactus - that needs to know where@b@   | your Tomcat instance is installed, you can provide a variable here such that the variable is@b@   | dereferenced during the build process to configure the cactus plugin.@b@   |@b@   | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles@b@   | section of this document (settings.xml) - will be discussed later. Another way essentially@b@   | relies on the detection of a system property, either matching a particular value for the property,@b@   | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a@b@   | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.@b@   | Finally, the list of active profiles can be specified directly from the command line.@b@   |@b@   | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact@b@   |       repositories, plugin repositories, and free-form properties to be used as configuration@b@   |       variables for plugins in the POM.@b@   |@b@   |-->@b@  <profiles>@b@    <!-- profile@b@     | Specifies a set of introductions to the build process, to be activated using one or more of the@b@     | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>@b@     | or the command line, profiles have to have an ID that is unique.@b@     |@b@     | An encouraged best practice for profile identification is to use a consistent naming convention@b@     | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.@b@     | This will make it more intuitive to understand what the set of introduced profiles is attempting@b@     | to accomplish, particularly when you only have a list of profile id's for debug.@b@     |@b@     | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.@b@    <profile>@b@      <id>jdk-1.4</id>@b@@b@      <activation>@b@        <jdk>1.4</jdk>@b@      </activation>@b@@b@      <repositories>@b@        <repository>@b@          <id>jdk14</id>@b@          <name>Repository for JDK 1.4 builds</name>@b@          <url>http://www.myhost.com/maven/jdk14</url>@b@          <layout>default</layout>@b@          <snapshotPolicy>always</snapshotPolicy>@b@        </repository>@b@      </repositories>@b@    </profile>@b@    -->@b@@b@    <!--@b@     | Here is another profile, activated by the system property 'target-env' with a value of 'dev',@b@     | which provides a specific path to the Tomcat instance. To use this, your plugin configuration@b@     | might hypothetically look like:@b@     |@b@     | ...@b@     | <plugin>@b@     |   <groupId>org.myco.myplugins</groupId>@b@     |   <artifactId>myplugin</artifactId>@b@     |@b@     |   <configuration>@b@     |     <tomcatLocation>${tomcatPath}</tomcatLocation>@b@     |   </configuration>@b@     | </plugin>@b@     | ...@b@     |@b@     | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to@b@     |       anything, you could just leave off the <value/> inside the activation-property.@b@     |@b@    <profile>@b@      <id>env-dev</id>@b@@b@      <activation>@b@        <property>@b@          <name>target-env</name>@b@          <value>dev</value>@b@        </property>@b@      </activation>@b@@b@      <properties>@b@        <tomcatPath>/path/to/tomcat/instance</tomcatPath>@b@      </properties>@b@    </profile>@b@    -->@b@<!--@b@	<profile>  @b@		<id>dev</id>  @b@		<repositories>  @b@		  <repository>  @b@			<id>remote-nexus</id>  @b@			<url>http://repo1.maven.org/maven2/</url>  @b@			<releases>  @b@			  <enabled>true</enabled>  @b@			</releases>  @b@			<snapshots>  @b@			  <enabled>true</enabled>  @b@			</snapshots>  @b@		  </repository> @b@			<repository>   @b@			  <id>maven-net-cn</id>   @b@			  <name>Maven China Mirror</name>   @b@			  <url>http://maven.net.cn/content/groups/public/</url>   @b@			  <releases>   @b@				<enabled>true</enabled>   @b@			  </releases>   @b@			  <snapshots>   @b@				<enabled>false</enabled>   @b@			  </snapshots>   @b@			</repository>   @b@		</repositories>   @b@		<pluginRepositories>   @b@		<pluginRepository>   @b@		  <id>maven-net-cn</id>   @b@		  <name>Maven China Mirror</name>   @b@		  <url>http://maven.net.cn/content/groups/public/</url>   @b@		  <releases>   @b@			<enabled>true</enabled>   @b@		  </releases>   @b@		  <snapshots>   @b@			<enabled>false</enabled>   @b@		  </snapshots>        @b@		</pluginRepository>@b@	  </pluginRepositories> @b@	 </profile> @b@-->@b@	<profile>  @b@		<id>201nexus</id>@b@		<repositories>  @b@		  <repository>  @b@			<id>public</id>  @b@			<url>http://192.168.1.201:8081/nexus/content/groups/public</url>  @b@			<releases>  @b@			  <enabled>true</enabled>  @b@			</releases>  @b@			<snapshots>  @b@			  <enabled>true</enabled>  @b@			</snapshots>  @b@		  </repository> @b@		</repositories>@b@		<pluginRepositories>   @b@		<pluginRepository>   @b@		  <id>public</id> @b@		  <url>http://192.168.1.201:8081/nexus/content/groups/public</url>   @b@		  <releases>   @b@			<enabled>true</enabled>   @b@		  </releases>   @b@		  <snapshots>   @b@			<enabled>true</enabled>   @b@		  </snapshots>        @b@		</pluginRepository> @b@	  </pluginRepositories> @b@	 </profile>@b@@b@  </profiles>@b@@b@  <!-- activeProfiles@b@   | List of profiles that are active for all builds.@b@   |@b@  <activeProfiles>@b@    <activeProfile>alwaysActiveProfile</activeProfile>@b@    <activeProfile>anotherAlwaysActiveProfile</activeProfile>@b@  </activeProfiles>@b@  -->@b@@b@  <activeProfiles>@b@    <activeProfile>201nexus</activeProfile>@b@  </activeProfiles>@b@@b@</settings>