tags:

views:

95

answers:

2

I am taking over a project left by previous colleague. The project is mavenized and I'm having a hard time building it. There is a inside block, which generates error when I ran mvn install. The error shows that plugin cannot be found in maven central repo. I checked and it's not there. I happened to find another internal repository that has the plugin jar file. So outside the block, I specified a to point at that internal repo. However, when I ran mvn install again, it still goes to maven central repo to look for the plugin. How do I make it look for the jar file at the right repo? I thought by specifying the list, it would automatically check that list? Other than the repo I added, there was no repository list set up previously.

The missing plugin that I can't get it to work is like this:

    <build>
        <plugins>
            <plugin>
            <groupId>com.totsp.gwt</groupId>
            <artifactId>maven-googlewebtoolkit2-plugin</artifactId>
           <version>2.0-SNAPSHOT</version>
            <configuration>
                <gwtVersion>2.0.0</gwtVersion>
                <style>OBF</style>
                <gen>target/gwtgen</gen>
                <runTarget>/</runTarget>
                <extraJvmArgs>-Xmx512m</extraJvmArgs>
                <port>8088</port>
                <useHtmlUnit>true</useHtmlUnit>
                <htmlUnitBrowsers>
                    <param>FF3</param>
                </htmlUnitBrowsers>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        </plugin>
    </build>
+1  A: 

Ok, now that you've provided the relevant part of your pom, I can say that you basically have two options here: either get the sources of the plugin and install it in your local repo or get the plugin from the maven repository of the project.

Option #1

Use a subversion client and get the sources of the plugin (version 2.0-SNAPSHOT is the current version) from the svn repository, build and install the plugin in your local repository. Here using the svn command line client:

$ svn co http://gwt-maven.googlecode.com/svn/trunk/maven-googlewebtoolkit2-plugin/ maven-googlewebtoolkit2-plugin
$ cd maven-googlewebtoolkit2-plugin
$ mvn install 

Note that this approach doesn't solve the portability issue (another developer would have to repeat the same steps) and I can't guarantee that you'll get exactly the same version of the code than the previous developer.

Option #2

Declare the Maven Repository of the project as a <pluginRepository> and change the version of the plugin (2.0-SNAPSHOT is not available). Something like this:

<pluginRepositories>
  <pluginRepository>
    <id>gwt-maven</id>
    <url>http://gwt-maven.googlecode.com/svn/trunk/mavenrepo&lt;/url&gt;
  </pluginRepository>
</pluginRepositories>
<build>
  <plugins>
    <plugin>
      <groupId>com.totsp.gwt</groupId>
      <artifactId>maven-googlewebtoolkit2-plugin</artifactId>
      <version>2.0-RC1</version>
      <configuration>
        <gwtVersion>2.0.0</gwtVersion>
        <style>OBF</style>
        <gen>target/gwtgen</gen>
        <runTarget>/</runTarget>
        <extraJvmArgs>-Xmx512m</extraJvmArgs>
        <port>8088</port>
        <useHtmlUnit>true</useHtmlUnit>
        <htmlUnitBrowsers>
          <param>FF3</param>
        </htmlUnitBrowsers>
      </configuration>
      <executions>
        <execution>
          <goals>
            <goal>test</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

Again, I can't say anything about the changes between this version and the 2.0-SNAPSHOT the other developer was using.

Last but not least (but this might not be a top priority for you right now), this plugin has been deprecated and is replaced by the gwt-maven-plugin from Codehaus. On the long term, you should consider moving to the Codehaus plugin.

Pascal Thivent
I included the missing plugin. Any idea?
swingfuture
@swingfuture My initial suggestion was and is still valid. But I've updated my answer to cover all options.
Pascal Thivent
I already did your first option, but failed. Got the jar file and ran: mvn install:install-file -DgroupId=com.totsp.gwt -DartifactId=maven-googlewebtoolkit2-plugin -Dversion=2.0-SNAPSHOT -Dpackaging=maven-plugin -Dfile=maven-googlewebtoolkit2-plugin-2.0-20091221.164529-1.jarthe error: "[INFO] A required plugin was not found: Plugin could not be found - check that the goal name is correct: Unable to download the artifact from any repository.com.totsp.gwt:maven-googlewebtoolkit2-plugin:maven-plugin:2.0-SNAPSHOTfrom the specified remote repositories: central (http://repo1.maven.org/maven2)"
swingfuture
@swingfuture I tested **Option #1** (the exact steps I provided) and it definitely works. Maybe clarify what "failed".
Pascal Thivent
It does work in your way. I used the mvn install:install-file suggestion that I got from error message while running mvn install -e. I pasted my error message above. Your way bypassed those routes and made it work. Thanks!
swingfuture
+1  A: 

I believe that your colleague has the pluginRepository configured in his ${MAVEN_HOME}/conf/settings.xml. Check if you have a company-wide repos which you need to configure in your Maven.

lexicore