Maven可选的依赖管理可能吗?

时间:2017-12-20 14:40:43

标签: maven dependency-management

鉴于以下结构:

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.3:update (default) on project sql: Error setting up or running Liquibase: liquibase.exception.DatabaseException: java.sql.SQLException: ORA-01017: invalid username/password; logon denied -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.3:update (default) on project sql: Error setting up or running Liquibase: liquibase.exception.DatabaseException: java.sql.SQLException: ORA-01017: invalid username/password; logon denied

当我使用测试构建项目时,我只想从my.group.id加载任何内容。但在给定的结构中,用

构建
...
<dependencyManagement>
  <dependency>
    <groupId>my.group.id</groupId>
    <artifactId>my-bom</artifactId>
    <version>${my-bom-version}</version>
    <optional>true</optional>
    <type>pom</type>
    <scope>import</scope>
  </dependency>
</dependencyManagement>

<profiles>
  <profile>
    <id>optionalDependency</id>
    <activation>
      <property>
        <name>skipTests</name>
        <value>!true</value>
      </property>
    </activation>
    <dependencies>
       <dependency>
         <groupId>my.group.id</groupId>
         <artifactId>some-module-in-my-group-id</artifactId>
         <optional>true</optional>
         <scope>test</scope>
       </dependency>
     </dependencies>
   </profile>
 </profiles>
 ...
无论如何,无论如何,我总是被装上了。是否有可能以这样的方式来抑制这种情况:当项目通过测试构建时,只能从nexus加载bom版本?

0 个答案:

没有答案