3

I am trying to install a Maven distribution from sourceforge (jtmt.sf.net) which provides a POM. Hoewever

mvn install

throws the error:

[ERROR]     'build.plugins.plugin[org.mortbay.jetty:maven-jetty6-plugin].depende
ncies.dependency.scope' for org.apache.geronimo.specs:geronimo-j2ee_1.4_spec:jar
 must be one of [compile, runtime, system] but is 'provided'. @ line 653, column
 20

The pom contains the code:

      <!-- For web development with Jetty6 -->
  <plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty6-plugin</artifactId>
    <configuration>
      <scanIntervalSeconds>10</scanIntervalSeconds>
      <connectors>
        <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
          <port>8081</port>
          <maxIdleTime>60000</maxIdleTime>
        </connector>
      </connectors>
    </configuration>
    <dependencies>
      <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-j2ee_1.4_spec</artifactId>
        <version>1.0</version>
        <scope>provided</scope>
      </dependency>
    </dependencies>
  </plugin>

I am assuming the POM worked in the past though the project is somewhat dormant now.

Is there some switch I should set when installing? (I am using mvn 3.0.3). FWIW the distrib has checked out a very large number of libraries in lib/ .

Charles
  • 50,943
  • 13
  • 104
  • 142
peter.murray.rust
  • 37,407
  • 44
  • 153
  • 217

1 Answers1

11

The project was probably working with Maven 2. Maven 3 is much more picky about scopes in plugins, and scope provided is no longer allowed in plugin dependencies. You can try:

  • removing the dependency entirely and rebuilding (scope provided means something should already make it available anyway)
  • removing just the <scope> tag (to make it a simple compile dependency)
  • if nothing helps, you can try building it with Maven 2

The reason provided is now disallowed in plugins is that provided is really for dependencies provided by the environment (e.g. app server) at runtime. Jetty is a special case - it's an app server used frequently as a plugin.

Jakub Wasilewski
  • 2,916
  • 22
  • 27
  • +1 Thanks. I think you are right about the maven version. I now have more errors (about the dependencies not being resolved although the jars are in the lib directory). Is there a way to set a switch on maven to run maven2 or do I have to download and install maven2? – peter.murray.rust Oct 12 '12 at 21:51
  • The dependency system for M3 is completely new (they now use a separate library called Aether), so such a switch is unlikely to exist. – Jakub Wasilewski Oct 12 '12 at 21:54
  • Thanks. in http://stackoverflow.com/questions/3157240/maven-3-worth-it it was stated that Maven3 is backwards compatible but maybe that is optimistic. – peter.murray.rust Oct 12 '12 at 22:52