現象:
mvn package が失敗します。
エラー
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-direct-dependencies) @ jbpm-designer-standalone ---
[INFO] Flag 'useClassesFromLastBuild' is set. Try to use existing output folder.
[INFO] Analyze dependencies of artifact 'org.jbpm:jbpm-designer-standalone:war:7.0.0.Beta6'.
[WARNING] Rule 0: de.is24.maven.enforcer.rules.IllegalTransitiveDependencyCheck failed with message:
Found 194 illegal transitive type dependencies in artifact 'org.jbpm:jbpm-designer-standalone:war:7.0.0.Beta6':
1.) org.drools.workbench.models.datamodel.auditlog.AuditLog
2.) org.drools.workbench.models.datamodel.auditlog.AuditLogEntry
3.) org.drools.workbench.models.datamodel.auditlog.AuditLogFilter
エラー
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce (enforce-direct-dependencies) on project jbpm-designer-standalone: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]
問題点:
そもそも何故このような現象が起こるかについてですが、
jbpm-designer の親にあたる
org.kie:kie-parent:7.0.0.Beta6 にチェックが仕込まれています。
C:\Git\jbpm-designer\pom.xml に次のような記述があります:
<parent>
<groupId>org.kie</groupId>
<artifactId>kie-parent</artifactId>
<version>7.0.0.Beta6</version>
<!-- relativePath causes out-of-date problems on hudson slaves -->
<!--<relativePath>../droolsjbpm-build-bootstrap/pom.xml</relativePath>-->
</parent>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-designer</artifactId>
<packaging>pom</packaging>
org.kie:kie-parent:7.0.0.Beta6 を求めて…
わたしの場合は、こちらのファイルに:
C:\Users\ku_000\.m2\repository\org\kie\kie-parent\7.0.0.Beta6\kie-parent-7.0.0.Beta6.pom
<execution>
<id>enforce-direct-dependencies</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<illegalTransitiveDependencyCheck
implementation="de.is24.maven.enforcer.rules.IllegalTransitiveDependencyCheck">
<regexIgnoredClasses combine.children="append">
<!-- The marshalling classes are generated by Errai during GWT compilation. These classes
usually contain references to other dependencies which are not part of the project
(transitive dependencies), which then results in the dependency check failure.
From the maintenance point of view, ignoring these generated classes seems like the
best option. -->
<regexIgnoredClass>org\.jboss\.errai\.marshalling\.server\.impl\.ServerMarshallingFactory.*
</regexIgnoredClass>
</regexIgnoredClasses>
</illegalTransitiveDependencyCheck>
</rules>
</configuration>
</execution>
対策:
(1) スキップしたい
スキップすることができます。
mvn package -Denforcer.skip=true
参考
スキップできたとしても、デプロイが失敗します。本質的な対策にはなりえません。
2017-03-01 13:43:47,282 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "jbpm-designer-standalone.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"jbpm-designer-standalone.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"jbpm-designer-standalone.war\".WeldStartService: Failed to start service
Caused by: org.jboss.weld.exceptions.DeploymentException: org/ext/uberfire/social/activities/model/SocialUser
Caused by: java.lang.NoClassDefFoundError: org/ext/uberfire/social/activities/model/SocialUser
Caused by: java.lang.ClassNotFoundException: org.ext.uberfire.social.activities.model.SocialUser from [Module \"deployment.jbpm-designer-standalone.war:main\" from Service Module Loader]"}}
(2) 対策したい
不足しているものを調査しないといけません。
mvn dependency:analyze -Denforcer.fail=false -DoutputXML=true
で、一覧化できます。
<dependency> についてくる
<version>...</version> は親プロジェクトの pom へ記述するようにし、末端プロジェクトの pom では削除するようにします。
<listMissingArtifacts>true</listMissingArtifacts> のほうを使います。記述方法については、オフィシャルを参照。
こうすると mvn package で次のようにパッケージ情報つきで教えてくれます。
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-direct-dependencies) @ jbpm-designer-client ---
[INFO] Flag 'listMissingArtifacts' is set. Transitively used artifacts are resolved.
[INFO] Flag 'useClassesFromLastBuild' is set. Try to use existing output folder.
[INFO] Analyze dependencies of artifact 'org.jbpm:jbpm-designer-client:jar:7.0.0.Beta6'.
[WARNING] Rule 0: de.is24.maven.enforcer.rules.IllegalTransitiveDependencyCheck failed with message:
Found 361 illegal transitive type dependencies in artifact 'org.jbpm:jbpm-designer-client:jar:7.0.0.Beta6':
1.) org.drools.workbench.models.datamodel.auditlog.AuditLog, [org.drools:drools-workbench-models-datamodel-api:jar:7.0.0.Beta6]
2.) org.drools.workbench.models.datamodel.auditlog.AuditLogEntry, [org.drools:drools-workbench-models-datamodel-api:jar:7.0.0.Beta6]
3.) org.drools.workbench.models.datamodel.auditlog.AuditLogFilter, [org.drools:drools-workbench-models-datamodel-api:jar:7.0.0.Beta6]
内容は itd-org.jbpm-jbpm-designer-client-jar-7.0.0.Beta6.txt にも保存されます。
以下、手作業で抽出したもの:
C:\Git\jbpm-designer\jbpm-designer-standalone\pom.xml で、
<!-- dependencies added because of new illegal transitive dependency check --> のところに不足している
dependency を追加していきます。
<!-- New! 7.0.0.Beta6 -->
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-workbench-models-datamodel-api</artifactId>
</dependency>
<dependency>
<groupId>org.guvnor</groupId>
<artifactId>guvnor-asset-mgmt-api</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.errai</groupId>
<artifactId>errai-cdi-shared</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.errai</groupId>
<artifactId>errai-marshalling</artifactId>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-form-modeler-api</artifactId>
</dependency>
<dependency>
<groupId>org.kie.workbench.screens</groupId>
<artifactId>kie-wb-common-default-editor-api</artifactId>
</dependency>
<dependency>
<groupId>org.kie.workbench.screens</groupId>
<artifactId>kie-wb-common-project-editor-api</artifactId>
</dependency>
<dependency>
<groupId>org.kie.workbench.services</groupId>
<artifactId>kie-wb-common-datamodel-api</artifactId>
</dependency>
<dependency>
<groupId>org.kie.workbench.services</groupId>
<artifactId>kie-wb-common-refactoring-api</artifactId>
</dependency>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-backend-api</artifactId>
</dependency>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-commons-editor-api</artifactId>
</dependency>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-widgets-properties-editor-api</artifactId>
</dependency>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-security-management-api</artifactId>
</dependency>