Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attachment creation fails if storage format is used for page definition #142

Closed
dgalanp opened this issue Aug 16, 2017 · 14 comments
Closed
Assignees
Milestone

Comments

@dgalanp
Copy link

dgalanp commented Aug 16, 2017

I'm testing at the moment version 5.0-rc5 of the plugin to generate a set of project report pages.

While trying to create a site structure using a site.xml descriptor, the deployment of the pages fail upon creation of an attachment if the storage format is used for the page definition:

[INFO] 
[INFO] --- confluence-reporting-maven-plugin:5.0-rc5:deploy (project-info-site-deploy) @ parent-pom ---
[INFO] executeReport isSnapshot = [true] isRemoveSnapshots = [true]
Site
 Page: Test parent POM - file:/home/soldev/Workspace/git/test-parent/target/classes/project.confluence
- Page: CIDL - file:/home/soldev/Workspace/git/test-parent/target/classes/children/CIDL.confluence
- Page: Test parent POM - Latest Release Notes - file:/home/soldev/Workspace/git/test-parent/target/classes/children/release-notes.xhtml
## Attachment: cucumber.json - file:/home/soldev/Workspace/git/test-parent/target/classes/attachments/cucumber.json
- Page: Test parent POM - Release Notes - file:/home/soldev/Workspace/git/test-parent/target/classes/children/release-notes-parent.confluence
-- Page: Test parent POM - 4.2.0-SNAPSHOT - Release Notes - file:/home/soldev/Workspace/git/test-parent/target/classes/children/release-notes.xhtml
### Attachment: cucumber.json - file:/home/soldev/Workspace/git/test-parent/target/classes/attachments/cucumber.json
[INFO] Confluence version [5.7.0-5780] development version [false]
[INFO] generateChildren # [3]
[INFO] generateAttachments pageId [21300274] title [Test parent POM]
[INFO] generateChild spacekey=[~dgalan] parentPageTtile=[Test parent POM]
Page: CIDL - file:/home/soldev/Workspace/git/test-parent/target/classes/children/CIDL.confluence
[INFO] generateChildren # [0]
[INFO] generateAttachments pageId [21300275] title [CIDL]
[INFO] generateChild spacekey=[~dgalan] parentPageTtile=[Test parent POM]
Page: Test parent POM - Latest Release Notes - file:/home/soldev/Workspace/git/test-parent/target/classes/children/release-notes.xhtml
[INFO] generateChildren # [0]
[INFO] generateAttachments pageId [21300288] title [Test parent POM - Latest Release Notes]
[INFO] generateAttachment pageId [21300288] title [Test parent POM - Latest Release Notes] file [file:/home/soldev/Workspace/git/test-parent/target/classes/attachments/cucumber.json]
[INFO] Creating new attachment for [cucumber.json]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.026 s
[INFO] Finished at: 2017-08-14T21:52:10+02:00
[INFO] Final Memory: 19M/263M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.bsc.maven:confluence-reporting-maven-plugin:5.0-rc5:deploy (project-info-site-deploy) on project parent-pom: error generating report: page argument is not right type! -

The site descriptor used is this:

<bsc:site xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:bsc='https://github.com/bsorrentino/maven-confluence-plugin' xsi:schemaLocation='https://github.com/bsorrentino/maven-confluence-plugin site-schema-5.0.xsd'>

    <home uri="project.confluence">
        <child name="CIDL" uri="children/CIDL.confluence">
          <label>cidl-item</label>
        </child>
        <child name="Test parent POM - Latest Release Notes" uri="children/release-notes.xhtml">
            <label>requirements-item</label>
            <attachment name="cucumber.json" uri="attachments/cucumber.json" />
        </child>
        <child name="Test parent POM - Release Notes" uri="children/release-notes-parent.confluence">
            <child name="Test parent POM - 4.2.0-SNAPSHOT - Release Notes" uri="children/release-notes.xhtml">
                <attachment name="cucumber.json" uri="attachments/cucumber.json" />
            </child>
        </child>
    </home>
</bsc:site>

If the attachment is done on a confluence markup defined page, the attachment of the file works flawlessly.

Also, if I remove the attachment creation from the site.xml descriptor, using the xhtml storage format, the pages are created correctly but orfaned.

@bsorrentino
Copy link
Owner

Hi, thanks for feedback

I'm investigating on root cause

@bsorrentino
Copy link
Owner

Hi

I've deployed a 5.0-SNAPHOST with fix ... could you test it and let me know ?

Thanks in advance

@dgalanp
Copy link
Author

dgalanp commented Aug 18, 2017

Hi!
First, thanks for your fast response.

Using the latest 5.0-SNAPSHOT I am still unable to publish using xhtml.

A more detailed error with the mvn -X flag:

[INFO] generateChildren # [2]
[INFO] generateAttachments pageId [21758167] title [Release Notes Prototype]
[INFO] generateChild spacekey=[~dgalan] parentPageTtile=[Release Notes Prototype]
Page: Release Notes Prototype CIDL - file:/home/soldev/Workspace/git/release-notes-prototype/target/classes/children/CIDL.confluence
[INFO] generateChildren # [0]
[INFO] generateAttachments pageId [21758168] title [Release Notes Prototype CIDL]
[INFO] generateChild spacekey=[~dgalan] parentPageTtile=[Release Notes Prototype]
Page: Release Notes Prototype - Latest Release Notes - file:/home/soldev/Workspace/git/release-notes-prototype/target/classes/children/release-notes.xhtml
[INFO] generateChildren # [0]
[INFO] generateAttachments pageId [21758169] title [Release Notes Prototype - Latest Release Notes]
[INFO] generateAttachment pageId [21758169] title [Release Notes Prototype - Latest Release Notes] file [file:/home/soldev/Workspace/git/release-notes-prototype/target/classes/attachments/cucumber.json]
[DEBUG] Error getting attachment [cucumber.json] from confluence: [java.lang.Exception: com.atlassian.confluence.rpc.RemoteException: No attachment on content with id 21758169, name 'cucumber.json' and version 0 exists.]
[INFO] Creating new attachment for [cucumber.json]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.464 s
[INFO] Finished at: 2017-08-18T13:23:40+02:00
[INFO] Final Memory: 23M/179M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.bsc.maven:confluence-reporting-maven-plugin:5.0-rc5:deploy (project-info-site-deploy) on project release-notes-prototype: error generating report: page argument is not right type! -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.bsc.maven:confluence-reporting-maven-plugin:5.0-rc5:deploy (project-info-site-deploy) on project release-notes-prototype: error generating report
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: error generating report
	at org.bsc.maven.confluence.plugin.ConfluenceDeployMojo.execute(ConfluenceDeployMojo.java:282)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 20 more
Caused by: java.lang.IllegalArgumentException: page argument is not right type!
	at org.codehaus.swizzle.confluence.XMLRPCConfluenceServiceImpl.cast(XMLRPCConfluenceServiceImpl.java:124)
	at org.codehaus.swizzle.confluence.XMLRPCConfluenceServiceImpl.addAttchment(XMLRPCConfluenceServiceImpl.java:187)
	at org.bsc.confluence.ConfluenceServiceFactory$MixedConfluenceService.addAttchment(ConfluenceServiceFactory.java:64)
	at org.bsc.maven.confluence.plugin.AbstractConfluenceSiteMojo.generateAttachment(AbstractConfluenceSiteMojo.java:184)
	at org.bsc.maven.confluence.plugin.AbstractConfluenceSiteMojo.generateAttachments(AbstractConfluenceSiteMojo.java:113)
	at org.bsc.maven.confluence.plugin.AbstractConfluenceSiteMojo.generateChildren(AbstractConfluenceSiteMojo.java:212)
	at org.bsc.maven.confluence.plugin.AbstractConfluenceSiteMojo.generateChildren(AbstractConfluenceSiteMojo.java:224)
	at org.bsc.maven.confluence.plugin.ConfluenceDeployMojo.generateProjectReport(ConfluenceDeployMojo.java:529)
	at org.bsc.maven.confluence.plugin.ConfluenceDeployMojo.access$000(ConfluenceDeployMojo.java:65)
	at org.bsc.maven.confluence.plugin.ConfluenceDeployMojo$2.call(ConfluenceDeployMojo.java:541)
	at org.bsc.maven.confluence.plugin.ConfluenceDeployMojo$2.call(ConfluenceDeployMojo.java:536)
	at org.bsc.confluence.ConfluenceServiceFactory$MixedConfluenceService.call(ConfluenceServiceFactory.java:127)
	at org.bsc.maven.confluence.plugin.AbstractBaseConfluenceMojo.confluenceExecute(AbstractBaseConfluenceMojo.java:208)
	at org.bsc.maven.confluence.plugin.ConfluenceDeployMojo.generateProjectReport(ConfluenceDeployMojo.java:536)
	at org.bsc.maven.confluence.plugin.ConfluenceDeployMojo.execute(ConfluenceDeployMojo.java:267)
	... 22 more
[ERROR] 

Again, thanks!

@bsorrentino
Copy link
Owner

bsorrentino commented Aug 18, 2017

thank you for test it

It's very strange ... because your exception refers to a line (XMLRPCConfluenceServiceImpl.java:187) that i've commented to solve issue itself....

probably you haven't used the last snapshot ... (maybe deployment error ?)

@dgalanp
Copy link
Author

dgalanp commented Aug 21, 2017

My apologies, it was my fault. I messed with the version number as the execution was also failing.
Please find the adequate log below:

Number of foreign imports: 1
import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

-----------------------------------------------------

	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution project-info-site-deploy of goal org.bsc.maven:confluence-reporting-maven-plugin:5.0-SNAPSHOT:deploy failed: An API incompatibility was encountered while executing org.bsc.maven:confluence-reporting-maven-plugin:5.0-SNAPSHOT:deploy: java.lang.NoSuchMethodError: org.bsc.confluence.rest.AbstractRESTConfluenceService.lambda$fromRequest$0(Lorg/bsc/confluence/rest/AbstractRESTConfluenceService;Lokhttp3/Request;Ljava/lang/String;Lrx/Subscriber;)V
-----------------------------------------------------
realm =    plugin>org.bsc.maven:confluence-reporting-maven-plugin:5.0-SNAPSHOT
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy

### SOME CLASSPATH ITEMS HERE ###

Number of foreign imports: 1
import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

-----------------------------------------------------

	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:183)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 20 more
Caused by: org.apache.maven.plugin.PluginContainerException: An API incompatibility was encountered while executing org.bsc.maven:confluence-reporting-maven-plugin:5.0-SNAPSHOT:deploy: java.lang.NoSuchMethodError: org.bsc.confluence.rest.AbstractRESTConfluenceService.lambda$fromRequest$0(Lorg/bsc/confluence/rest/AbstractRESTConfluenceService;Lokhttp3/Request;Ljava/lang/String;Lrx/Subscriber;)V
-----------------------------------------------------
realm =    plugin>org.bsc.maven:confluence-reporting-maven-plugin:5.0-SNAPSHOT
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/home/soldev/.m2/repository/org/bsc/maven/confluence-reporting-maven-plugin/5.0-SNAPSHOT/confluence-reporting-maven-plugin-5.0-SNAPSHOT.jar

### SOME MORE CLASSPATH ITEMS HERE ###

urls[93] = file:/home/soldev/.m2/repository/org/slf4j/slf4j-nop/1.7.12/slf4j-nop-1.7.12.jar
Number of foreign imports: 1
import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

-----------------------------------------------------

	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:181)
	... 21 more
Caused by: java.lang.NoSuchMethodError: org.bsc.confluence.rest.AbstractRESTConfluenceService.lambda$fromRequest$0(Lorg/bsc/confluence/rest/AbstractRESTConfluenceService;Lokhttp3/Request;Ljava/lang/String;Lrx/Subscriber;)V
	at org.bsc.confluence.rest.AbstractRESTConfluenceService$$Lambda$1.call(Unknown Source)
	at rx.Observable.unsafeSubscribe(Observable.java:9861)
	at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
	at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
	at rx.Observable.unsafeSubscribe(Observable.java:9861)
	at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
	at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
	at rx.Observable.subscribe(Observable.java:9957)
	at rx.Observable.subscribe(Observable.java:9924)
	at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:445)
	at rx.observables.BlockingObservable.first(BlockingObservable.java:168)
	at org.bsc.confluence.rest.RESTConfluenceServiceImpl.storePage(RESTConfluenceServiceImpl.java:237)
	at org.bsc.confluence.ConfluenceServiceFactory$MixedConfluenceService.storePage(ConfluenceServiceFactory.java:91)
	at org.bsc.maven.confluence.plugin.AbstractConfluenceMojo$1.call(AbstractConfluenceMojo.java:292)
	at org.bsc.maven.confluence.plugin.AbstractConfluenceMojo$1.call(AbstractConfluenceMojo.java:1)
	at org.bsc.confluence.model.Site.processUri(Site.java:156)
	at org.bsc.maven.confluence.plugin.AbstractConfluenceMojo.generateChild(AbstractConfluenceMojo.java:276)
	at org.bsc.maven.confluence.plugin.AbstractConfluenceSiteMojo.generateChildren(AbstractConfluenceSiteMojo.java:216)
	at org.bsc.maven.confluence.plugin.ConfluenceDeployMojo.generateProjectReport(ConfluenceDeployMojo.java:529)
	at org.bsc.maven.confluence.plugin.ConfluenceDeployMojo.access$0(ConfluenceDeployMojo.java:476)
	at org.bsc.maven.confluence.plugin.ConfluenceDeployMojo$2.call(ConfluenceDeployMojo.java:541)
	at org.bsc.maven.confluence.plugin.ConfluenceDeployMojo$2.call(ConfluenceDeployMojo.java:1)
	at org.bsc.confluence.ConfluenceServiceFactory$MixedConfluenceService.call(ConfluenceServiceFactory.java:130)
	at org.bsc.maven.confluence.plugin.AbstractBaseConfluenceMojo.confluenceExecute(AbstractBaseConfluenceMojo.java:207)
	at org.bsc.maven.confluence.plugin.ConfluenceDeployMojo.generateProjectReport(ConfluenceDeployMojo.java:536)
	at org.bsc.maven.confluence.plugin.ConfluenceDeployMojo.execute(ConfluenceDeployMojo.java:267)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	... 21 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

Thanks again for your help.

@bsorrentino
Copy link
Owner

Which version of java are you currently using ?

@dgalanp
Copy link
Author

dgalanp commented Aug 21, 2017

At the moment I'm using:

java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

@dgalanp
Copy link
Author

dgalanp commented Aug 22, 2017

Hi!
I've seen you committed. Is there a new snapshot I can try?
By the way. Is there a limitation in the version of confluence to use? We are on 5.7 at the moment.
Thanks!

@bsorrentino
Copy link
Owner

bsorrentino commented Aug 22, 2017

I'm arranging the final 5.0 also with your fix .... (i've tested your condition in my integration test)

Please try it ...

Thanks in advance for support

@bsorrentino bsorrentino added this to the 5.0 milestone Aug 22, 2017
@dgalanp
Copy link
Author

dgalanp commented Aug 22, 2017

No, thanks to you for making our lives easier! :)
I'll give it a try

@dgalanp
Copy link
Author

dgalanp commented Aug 23, 2017

Hi!
I compiled latest commit in 5.0 release branch and tried it.
When a page with xhtml format with or without an attachment is re-deployed, the page is updated but ends up being orphaned.
Pages markup formatted are updated properly.
Cheers,
D

@bsorrentino
Copy link
Owner

Im my tests contained in maven-confluence-test project this doesn't happen

@dgalanp
Copy link
Author

dgalanp commented Aug 24, 2017

Interesting...
Do you re-deploy the pages in the test? It only happens the second time you deploy the same page. It seems to loose the parent. Actually the third time I try to deploy, the plugin fails as the name of the page already exists but it is no longer in the same place in the hierarchy.
May it be related to the confluence version? (5.7 in my case)
Are you using REST or XMLRPC? (XMLRPC in my case as I was unable to configure REST properly)

@bsorrentino
Copy link
Owner

I've tested both api protocols on confluence6 and works. (I'll arrange a test with the version 5.x)

Just for clarification :

  • Does Redeploy mean that you re-run site deployment again ?
  • Relocation fails because the same page (same title) cannot appears in confluence twice (any space). The best practice is to delete previous site (delete goal) and redeploy the new with relocation

Note:

I'm releasing version 5.0 of plugin just know and I've considered this issue fixed. I'll create another issue for parent lost during redeployment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants