Wrong Maven Jetty Plugin : org.apache.maven.plugins:maven-jetty-plugin

Maven Jetty plugin helps to have a quick feedback cycle in web application development. Recently I got a problem with this plugin. I had two web application projects configured for jetty as follows in their POMs . But jetty was behaving differently in different projects. Maven wrongly resolving this artifact to be in org.apache.maven.plugins group.

Folllowing is the configuration I did in my both projects:


<plugin>
	<groupId>org.mortbay.jetty</groupId>
	<artifactId>maven-jetty-plugin</artifactId>
	<version>6.0.0</version>
	<configuration>
		<webDefaultXml>src/test/resources/webdefault.xml</webDefaultXml>
		<systemProperties>
			<systemProperty>
				<name>jetty.port</name>
				<value>8081</value>
			</systemProperty>
		</systemProperties>
		<contextPath>/</contextPath>
		<scanIntervalSeconds>3000</scanIntervalSeconds>
		<scanTargets>
			<scanTarget>src/main/webapp/WEB-INF</scanTarget>
			<scanTarget>../target/classes</scanTarget>
		</scanTargets>
	</configuration>
</plugin>

It was working fine in one project , but in another project I got following error stack trace when executing mvn jetty:run
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'jetty'.
[INFO] artifact org.apache.maven.plugins:maven-jetty-plugin: checking for updates from central
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-jetty-plugin' does not exist or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Mon Dec 29 10:53:14 IST 2008
[INFO] Final Memory: 2M/4M
[INFO] ------------------------------------------------------------------------

Although we have specified the groupId in our pom, maven still trying to find maven-jetty-plugin in org.apache.maven.plugins group. I don’t know why it is resolving it like that 😦 .

I found following suggestions in the net

  • Specify proper group id : which we did already
  • Remove ~/.m2/repository/org/apache/maven/plugins folder as the local maven repository might have got corrupted
  • Remove all folders and files with with jetty in their names

But none of the above worked for me. Finally I tried adding the org.mortbay.jetty plugin group to my settings.xml as follows

 <pluginGroups>
    <pluginGroup>org.mortbay.jetty</pluginGroup>
  </pluginGroups>

Then it worked like a charm. I would like to hear any suggestions or reasons why its behaving like this. Thanks in advance for your suggestions and directions.

Advertisements

19 thoughts on “Wrong Maven Jetty Plugin : org.apache.maven.plugins:maven-jetty-plugin

  1. Hey Ganesh!

    I just ran into this problem too.
    After a while I realized that the problem was that the plugin was only declared in a specific profile. So, obviously, when running maven with the default profile, the plugin could not be found.

    Thanks for the post, it pointed me in the right direction.

  2. With havin so much content do you ever run into any issues
    of plagorism or copyright violation? My website has a lot of exclusive content I’ve either
    written myself or outsourced but it looks like a lot of it is popping it up all over the internet without my agreement.
    Do you know any methods to help protect against content
    from being stolen? I’d definitely appreciate it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s