Hi Vincent, 2013/3/7 Vincent Massol <[email protected]>
On Mar 6, 2013, at 6:16 PM, Jeremie BOUSQUET <[email protected]> wrote:
Hi,
@Vincent : I agree with all your points, my feedback was more on that these points may not be clear for contributors at first (at least, it wasn't for me).
We need to put all information on contrib.xwiki.org so if you think something is missing there, maybe you could add it?
My only little worry is that maybe it does not require the same level of knowledge to merely create and publish a simple extension on xwiki.org, and to develop a maven module for it and release it to Nexus staging from github, though it'd be better to have all extensions in a maven repository (for flavors/bundles for example).
Sure it doesn't! This is why contrib.xwiki.org provides explanations.
Additionnally, it seems that with the sample pom provided (for xar), I always get the following error when trying to release:
[INFO] --- maven-enforcer-plugin:1.1:enforce (enforce-javadoc-exists) @ xwiki-macro-tabs --- [WARNING] Rule 0: org.apache.maven.plugins.enforcer.EvaluateBeanshell failed with message: Couldn't evaluate condition: ("xar" != "jar") || ("xar" == "jar" && new
java.io.File("C:\PRIVATE\tabs-macro\target\checkout\target/xwiki-macro-tabs-1.0.1-SNAPSHOT-javadoc.jar")
.exists())
The rule we have in the commons pom is:
<condition>("${project.packaging}" != "jar") || ("${project.packaging}" == "jar" && new java.io.File("${project.build.directory}/${project.build.finalName}-javadoc.jar").exists())</condition>
so I guess replacing all "\" with "/" in ${project.build.directory} should work.
It's strange that it fails since the first condition is true so it shouldn't even evaluate the second oneā¦
Maybe you could try to duplicate this rule in your pom to verify if it works:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> <executions> <execution> <id>enforce-javadoc-exists</id> <phase>verify</phase> <goals> <goal>enforce</goal> </goals> <configuration> <rules> <evaluateBeanshell> <condition>("${project.packaging}" != "jar") || ("${project.packaging}" == "jar" && new java.io.File("${project.build.directory}\${project.build.finalName}-javadoc.jar").exists())</condition> <message>Missing Javadoc JAR</message> </evaluateBeanshell> </rules> <fail>true</fail> </configuration> </execution> <executions> </plugin> </plugins> </build>
That does not work either ("Failed to evaluate condition..."). I think problem is with '\' and not '/', and that I'm stuck on an enforcer issue [1] I tried to do some string replacements, without success. Then I also checked with a string literal, replacing the condition as follows: <condition>("${project.packaging}" != "jar") || ("${project.packaging}" == "jar" && "test with a \ character" != "test without it")</condition> That also fails. I think trying to do replacements in beanshell is already too late, it seems to me that it's enforcer that fails to evaluate the beanshell syntax because of non-escaped '\'. Going a little further, the problem is that the path must already be correct before putting the property in the evaluateBeanshell condition. So I've come out with the following solution, that works correctly now. I checked it both for failure and success conditions (missing or existing javadoc jar) : <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.7</version> <executions> <execution> <id>create-javadoc-filename-property</id> <phase>verify</phase> <goals><goal>regex-property</goal></goals> <configuration> <name>javadoc-filename</name> <value>${project.build.directory}/${project.build.finalName}-javadoc.jar</value> <regex>\\</regex> <replacement>/</replacement> <failIfNoMatch>false</failIfNoMatch> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> <executions> <execution> <id>enforce-javadoc-exists</id> <phase>verify</phase> <goals> <goal>enforce</goal> </goals> <configuration> <rules> <evaluateBeanshell> <condition>("${project.packaging}" != "jar") || ("${project.packaging}" == "jar" && new java.io.File("${javadoc-filename}").exists())</condition> <message>Missing Javadoc JAR</message> </evaluateBeanshell> </rules> <fail>true</fail> </configuration> </execution> </executions> </plugin> Seems like a hack, and it is, but works nicely, and as long as [1] is not fixed you might want to get inspiration to fix it in commons pom for windows users, I think now I'll use that to avoid skipping the enforcer rule completely. BR, Jeremie [1] - http://jira.codehaus.org/browse/MENFORCER-100
Thanks -Vincent
I think maybe it's because of being on Windows (as show by the paths),
that
would explain why you seem not to have this problem ;-)
It's easily workaround by skiping that enforcer rule, but it's kind of a dirty workaround.
BR, Jeremie
2013/3/3 Vincent Massol <[email protected]>
Hi Jeremie,
On Feb 22, 2013, at 12:01 PM, Jeremie BOUSQUET < [email protected]> wrote:
Hi Vincent,
Very nice and welcome add :)
Just a small remark, maybe it's written somewhere else (or obvious enough), but if you have an extension that depends on another extension that is not in a maven, but only in an xwiki repository, then of course you can't define this dependency in your pom.xml, and there is an additional step after "import" from repository application, it is to manually add those kind of dependencies.
Indeed.
Actually the only good solution for this is to never depend on an extension that is not published in a maven repository.
If you do then you don't have a proper working build. I don't see how you're able to write automated functional tests for your extension either this way. So it means you have an incomplete build.
Thus the solution is to first publish the extension in a maven repository, by creating a repo for it in xwiki-contrib and releasing it.
Thanks -Vincent
BR, Jeremie
2013/2/22 Vincent Massol <[email protected]>
Hi guys,
I've just added explanations on how to publish a contrib extension on extensions.xwiki.org here:
http://contrib.xwiki.org/xwiki/bin/view/Main/WebHome#HPublishingonextensions...
Hope it helps, -Vincent
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs