Cobertura plugin building does not work
Asked by Ferenc Deak:

Hi,

I am trying to follow the steps at <https://bitbucket.org/i386/bamboo-cobertura-plugin/overview> to build a cobertura plugin, but the process fails with the error message below.

Any hints on how to fix it?
> solutions@bamboo:\~/test/bamboo-cobertura-plugin$ mvn package -e  
> + Error stacktraces are turned on.  
> \[INFO\] Scanning for projects...  
> Downloading: [http://repo1.maven.org/maven2/com/atlassian/maven/plugins/maven-bamboo-plugin/4.0/maven-bamboo-plugin-4.0.pom
> \[INFO\]](http://repo1.maven.org/maven2/com/atlassian/maven/plugins/maven-bamboo-plugin/4.0/maven-bamboo-plugin-4.0.pom%3Cbr%3E%5BINFO%5D) Unable to find resource 'com.atlassian.maven.plugins:maven-bamboo-plugin:pom:4.0' in repository central ([http://repo1.maven.org/maven2)
> Downloading:](http://repo1.maven.org/maven2%29%3Cbr%3EDownloading:) [http://repo1.maven.org/maven2/com/atlassian/maven/plugins/maven-bamboo-plugin/4.0/maven-bamboo-plugin-4.0.pom
> \[INFO\]](http://repo1.maven.org/maven2/com/atlassian/maven/plugins/maven-bamboo-plugin/4.0/maven-bamboo-plugin-4.0.pom%3Cbr%3E%5BINFO%5D) Unable to find resource 'com.atlassian.maven.plugins:maven-bamboo-plugin:pom:4.0' in repository central ([http://repo1.maven.org/maven2)
> \[INFO\]](http://repo1.maven.org/maven2%29%3Cbr%3E%5BINFO%5D) ------------------------------------------------------------------------  
> \[ERROR\] BUILD ERROR  
> \[INFO\] ------------------------------------------------------------------------  
> \[INFO\] Error building POM (may not be this project's POM).  
>
> <br />
>
> Project ID: com.atlassian.maven.plugins:maven-bamboo-plugin  
>
> Reason: POM 'com.atlassian.maven.plugins:maven-bamboo-plugin' not found in repository: Unable to download the artifact from any repository  
>
> com.atlassian.maven.plugins:maven-bamboo-plugin:pom:4.0  
>
> from the specified remote repositories:  
> central ([http://repo1.maven.org/maven2)
> \<br\< a=""\>\> for project com.atlassian.maven.plugins:maven-bamboo-plugin
> <br />
> \[INFO\] ------------------------------------------------------------------------
> \[INFO\] Trace
> org.apache.maven.lifecycle.LifecycleExecutionException: Unable to build project for plugin 'com.atlassian.maven.plugins:maven-bamboo-plugin': POM 'com.atlassian.maven.plugins:maven-bamboo-plugin' not found in repository: Unable to download the artifact from any repository
> com.atlassian.maven.plugins:maven-...
> <br />](http://repo1.maven.org/maven2%29%3Cbr%3E%3Cbr)[http://repo1.maven.org/maven2)
> \<br\< a=""\>\> for project com.atlassian.maven.plugins:maven-bamboo-plugin
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.loadPluginFully(DefaultLifecycleExecutor.java:1599)
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.findArtifactTypeHandlersInPlugins(DefaultLifecycleExecutor.java:1468)
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.findExtensions(DefaultLifecycleExecutor.java:222)
> at org.apache.maven.lifecycle.Def...
> <br />
> <br />
> <br />
> <br />
> <br />
> <br />
> <br />
> <br />
> <br />
> <br />
> <br />
> <br />
> <br />
> <br />
> <br />
> <br />](http://repo1.maven.org/maven2%29%3Cbr%3E%3Cbr)[http://repo1.maven.org/maven2)
> \<br\< a=""\>\> for project com.atlassian.maven.plugins:maven-bamboo-plugin
> at org.apache.maven.plugin.DefaultPluginManager.checkRequiredMavenVersion(DefaultPluginManager.java:293)
> at org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(DefaultPluginManager.java:205)
> at org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:184)
> at org.apache.maven.plugin.DefaultPluginManager.loadPluginFully(DefaultP...
> <br />
> <br />
> <br />
> <br />
> <br />
> <br />](http://repo1.maven.org/maven2%29%3Cbr%3E%3Cbr)[http://repo1.maven.org/maven2)
> \<br\< a=""\>\> for project com.atlassian.maven.plugins:maven-bamboo-plugin
> at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:605)
> at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:251)
> at org.apache.maven.plugin.DefaultPluginManager.checkRequiredMavenVersion(DefaultPluginManager.java:277)
> ... 19 more
> Caused by: org.apache.mave...
> <br />
> <br />
> <br />](http://repo1.maven.org/maven2%29%3Cbr%3E%3Cbr)[http://repo1.maven.org/maven2)
> \<br\< a=""\>\> at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:228)
> at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)
> at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:558)
> ... 21 more
> Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to download the artifact...
> <br />
> <br />
> <br />
> <br />
> <br />
> <br />](http://repo1.maven.org/maven2%29%3Cbr%3E%3Cbr%3E%3Cbr)
> [](http://repo1.maven.org/maven2%29%3Cbr%3E%3Cbr%3E%3Cbr)


Answers:
author: PiotrA
body: Hello Ferenc,

Are you using Atlassian Plugin SDK bundled-in maven? My guess would be that you are using plain maven, which has no atlassian's public maven repositories configured - that's why it complain about missing artifacts... Could you try downloading Atlassian Plugin SDK and use 'atlas-mvn' from it instead of 'mvn' ?

Does it make sense?

comments: author: Ferenc Deak
body: Thank you, Yes, it fixed the error above ... Now I get the following:
>
> \[INFO\] ------------------------------------------------------------------------  
> \[ERROR\] BUILD FAILURE  
> \[INFO\] ------------------------------------------------------------------------  
> \[INFO\] Compilation failure  
>
> /home/solutions/i386-bamboo-cobertura-plugin-2d35b690ebb5/src/main/java/com/atlassian/bamboo/plugins/cobertura/CoberturaResultWebItemCondition.java:\[39,45\] BUILD_KEY is not public in com.atlassian.bamboo.plugins.cobertura.tasks.CoberturaTask; cannot be accessed from outside package  
>
> .....
>
> <br />
>
> /home/solutions/i386-bamboo-cobertura-plugin-2d35b690ebb5/src/main/java/com/atlassian/bamboo/plugins/cobertura/CoberturaResultWebItemCondition.java:\[41,54\] BUILD_NUMBER is not public in com.atlassian.bamboo.plugins.cobertura.tasks.CoberturaTask; cannot be accessed from outside package  
>
> /home/solutions/i386-bamboo-cobertura-plugin-2d35b690ebb5/src/main/java/com/atlassian/bamboo/plugins/cobertura/CoberturaResultWebItemCondition.java:\[42,40\] BUILD_NUMBER is not public in com.atlassian.bamboo.plugins.cobertura.tasks.CoberturaTask; cannot be accessed from outside package  
>
> /home/solutions/i386-bamboo-cobertura-plugin-2d35b690ebb5/src/main/java/com/atlassian/bamboo/plugins/cobertura/CoberturaBuildProcessorServer.java:\[70,20\] cannot find symbol  
> symbol : method getLastSuccessfulBuildSummary(java.lang.String)  
> location: interface com.atlassian.bamboo.resultsummary.BuildResultsSummaryManager  
>
> <br />
>
> \[INFO\] ------------------------------------------------------------------------  
> \[INFO\] For more information, run Maven with the -e switch  
> \[INFO\] ------------------------------------------------------------------------  
> \[INFO\] Total time: 18 seconds  
> \[INFO\] Finished at: Tue Dec 18 12:30:46 CET 2012  
> \[INFO\] Final Memory: 94M/313M  
> \[INFO\] ------------------------------------------------------------------------

and one more "annot be accessed from outside package  
", I had to remove due to space limitation in this comment.


author: Ferenc Deak
body: Nevermind the compile errors, I have bamboo 4.3 so the API seems a little bit incompatible. Here is the fix:

1. in ./src/main/java/com/atlassian/bamboo/plugins/cobertura/tasks/CoberturaTask.java make the symbols public

2. in ./src/main/java/com/atlassian/bamboo/plugins/cobertura/CoberturaBuildProcessorServer.java  
replace the complained about line with:

```
PlanKey pk = PlanKeys.getPlanKey(buildContext.getPlanKey());            BuildResultsSummary previousSummary = (com.atlassian.bamboo.resultsummary.BuildResultsSummary)buildResultsSummaryManager                    .getLastSuccessfulResultSummary(pk);
```

It should work now.


author: PiotrA
body: Just curious - do you consider pushing back (via pull-request) your changes to the <https://bitbucket.org/i386/bamboo-cobertura-plugin> repository, so these changes can be shared among the community?

Not sure if that is feasible though...


author: Ferenc Deak
body: I will try tomorrow :)


author: PiotrA
body: ![](http://shirtoid.com/wp-content/uploads/2009/12/nom-nom-nom.jpg)............


author: Ferenc Deak
body: Cannot create a pull request, however I have created a mercurial bundle file. I will contact the previous developer to see what should I do with it.