maven tomcat远程发布

我表示这个插件在tomcat6下是可以运行的mvn tocmat:redeploy

 

<build>
		<directory>target</directory><!-- 这是打包的文件的路径。默认是该工程的根目录。 -->
		<plugins><!-- tomcat 的插件 -->
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
                <artifactId>tomcat-maven-plugin</artifactId>
				<configuration>
					<!-- <path>/mavenwebdemo</path> -->
					<url>http://192.168.2.102:8080/manager</url>
					<server>tomcat</server>
					<path>/SSHMJ-FRANK</path>
				</configuration>
			</plugin>
		</plugins>
	</build>

 很高兴经过几小时后的折腾 , 可以将maven远程发布到tomcat7的过程写下来

 

<url>http://mvnrepository.com/</url>
	<repositories>
		<repository>
			<id>people.apache.snapshots</id>
			<url>http://mvnrepository.com/</url>
			<releases>
				<enabled>false</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
	</repositories>
	
	<pluginRepositories>
		<pluginRepository>
			<id>apache.snapshots</id>
			<name>Apache Snapshots</name>
			<url>http://mvnrepository.com/</url>
			<releases>
				<enabled>false</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</pluginRepository>
	</pluginRepositories>
	
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.tomcat.maven</groupId>
				<artifactId>tomcat7-maven-plugin</artifactId>
				<version>2.1</version>  
				<configuration>
					<url>http://192.168.2.102:8080/manager/text</url>
					<server>tomcat</server>
					<path>/SSHMJ-FRANK</path>
					<username>qq</username>
    				<password>123456</password>
				</configuration>
			</plugin>
		</plugins>
	</build> 
 看到红色的server没 , 哪里其实就是部署的角色的配置

 

在maven的配置文件中setting.xml

<server>
      <id>tomcat</id>
      <username>qq</username>
      <password>123456</password>
    </server>

 那么这个用户就是发布的用户了 , 用户就要设置角色tomcat-user.xml

<role rolename="manager"/>
	<role rolename="admin"/>
	<role rolename="manager-gui"/>
	<role rolename="manager-script"/>
	<role rolename="tomcat"/>
	<role rolename="role1"/>
	<user username="admin" password="123456" roles="admin,manager,manager-gui"/>
	<user username="qq" password="123456" roles="manager-script,tomcat,role1,admin,manager,manager-gui"/>

 看到没 ,管他什么事情,我以后就用qq用户了 , 他什么都能干。

 

这样的我的文章的搜索率可能低点

我加两个异常[INFO] tomcatManager status code:403, ReasonPhrase:Prohibido

[INFO] tomcatManager status code:403, ReasonPhrase:Prohibido

 [INFO] tomcatManager status code:401, ReasonPhrase:Unauthorized

[INFO] tomcatManager status code:401, ReasonPhrase:Unauthorized

 看到没 , 反正就是你没有权限 , 按照我说的 , tomcat-user.xml配置用户最大权限 , 配置了还报错那是因为你tomcat服务没有重启的缘故

 

这样这下面的问题终于解决了

http://stackoverflow.com/questions/13336816/tomcat7-maven-plugin-tomcatmanager-status-code403-reasonphraseforbbiden

http://stackoverflow.com/questions/14023836/now-getting-401-unauthorized-in-jenkins-when-deploying-artifact-to-archiva-maven

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值