相关疑难解决方法(0)

Maven - settings.xml中的<server />

我使用tomcat-maven-plugin将我的战争部署到服务器.我要做的是在我的pom.xml中配置它:

<configuration>
...
   <url>http://localhost/manager</url>
   <username>admin</username>
   <password>admin</password>
...
</configuration>
Run Code Online (Sandbox Code Playgroud)

但是后来我显然希望将这些设置保存在不同的地方,因为我在我的计算机上工作但是然后有一个升级和一个实时服务器以及服务器的设置不同.

所以让我们使用.m2/settings.xml:

<servers>
    <server>
        <id>local_tomcat</id>
        <username>admin</username>
        <password>admin</password>
    </server>
</servers>
Run Code Online (Sandbox Code Playgroud)

现在更改pom.xml:

<configuration>
    <server>local_tomcat</server>
</configuration>
Run Code Online (Sandbox Code Playgroud)

但是在哪里放置服务器的URL?在服务器标签下的settings.xml中没有这个位置!也许是这样的?

<profiles>
  <profile>
     <id>tomcat-config</id>
      <properties>
    <tomcat.url>http://localhost/manager</tomcat.url>
      </properties>
  </profile>
</profiles>

<activeProfiles>
   <activeProfile>tomcat-config</activeProfile>
</activeProfiles>
Run Code Online (Sandbox Code Playgroud)

..并使用$ {tomcat.url}属性.

但问题是,为什么要使用服务器标签settings.xml呢?为什么不使用属性作为用户名和密码呢?或者URL是否也存在于设置URL中,因此我不必使用属性?

maven maven-tomcat-plugin

27
推荐指数
2
解决办法
4万
查看次数

标签 统计

maven ×1

maven-tomcat-plugin ×1