Recent Posts
Archives

PostHeaderIcon Maven 3: ‘build.plugins.plugin[…].dependencies.dependency.scope’ for … must be one of [compile, runtime, system] but is ‘test’

Case

I am migrating a project from Maven 2 to Maven 3. Fortunately, Maven 3 is said to be mostly back-compatible with Maven 2.
Anyway, on first build, I got this message:

[java][INFO] Scanning for projects…
[ERROR] The build could not read 3 projects -> [Help 1]
[ERROR]
[ERROR] The project lalou.jonathan.rmi-server:1.10.0-SNAPSHOT (C:\workarea\…\pom.xml) has 2 errors
[ERROR] ‘build.plugins.plugin[org.codehaus.mojo:weblogic-maven-plugin].dependencies.dependency.scope’ for org.slf4j:slf4j-log4j12:jar must be one of [compile, runtime, system]
but is ‘test’. lalou.jonathan:rmi-server:${project.parent.version}, C:\workarea\…\pom.xml, line 103,
column 32[/java]

Quick fix

Introduce a tag pluginManagement between build and plugins, ie replace:

[xml]
<build>
(…)
<plugins>
(…)
[/xml]

with:

[xml]
<build>
(…)
<pluginManagement>
<plugins>
(…)
[/xml]

3 Responses to “Maven 3: ‘build.plugins.plugin[…].dependencies.dependency.scope’ for … must be one of [compile, runtime, system] but is ‘test’”

  • Java user says:

    Hi,
    Tried using your step for the similar issue which I get when I try to migrate from m2 to m3 .
    build.plugins.plugin[org.codehaus.mojo:weblogic-maven-plugin].depen
    dencies.dependency.scope’ for weblogic:weblogic:jar must be one of [compile, run
    time, system] but is ‘provided’. @ line 36, column 20
    it was never successful . please let me if there is another way that we can fix similar issues

  • Baskar says:

    in POM.xml the dependencies tag should be placed under as depicted below:

    4.0.0
    Sel_Integration
    Sel_Integration
    0.0.1-SNAPSHOT

    org.testng
    testng
    7.6.1
    test

  • Baskar says:

    in pom.xml, dependencies should be placed under versions at the 6th line, this would work..

Leave a Reply