Following is a snippet of a POM that would do the post processing as I've
indicated from '$.{' to '${' :

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>2.0.1</version>
        <configuration>

<outputDirectory>${project.build.directory}/pre-site</outputDirectory>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.6</version>
        <executions>
          <execution>
            <id>site</id>
            <phase>site</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <copy todir="${project.build.directory}/site">
                  <fileset dir="${project.build.directory}/pre-site">
                    <exclude name="**/*.html"/>
                  </fileset>
                </copy>
                <copy todir="${project.build.directory}/site">
                  <fileset dir="${project.build.directory}/pre-site">
                    <include name="**/*.html"/>
                  </fileset>
                  <filterchain>
                    <tokenfilter>
                      <replaceregex pattern="\$\.\{" replace="${"
flags="g"/>
                    </tokenfilter>
                  </filterchain>
                </copy>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
    ..
    </plugins>
   </build>

Thanks.

Alejandro

On Mon, Oct 17, 2011 at 4:35 PM, Alejandro Abdelnur <[email protected]>wrote:

> Hi Param,
>
> We could do a find and replace of single quotes for double quotes. We'll
> have to go through out all twiki docs as we convert them to APT, thus this
> could be done then as well.
>
> Not that happy with the #set() syntax, I'd go for $.{ } with post
> processing. Does in this case the single quote fails?
>
> Thanks.
>
> Alejandro
>
> On Mon, Oct 17, 2011 at 4:21 PM, Params <[email protected]> wrote:
>
>> Hi Alejandro,
>>
>> There is another problem in using this workaround. If we have any
>> single-quotes inside the function $, then the parse still fails, unless we
>> convert all of them to double-quotes.
>>
>> eg the following will still fail:
>> <value>#set($varline = '${wf:errorCode('wordcount')}')  ${varline}</value>
>>
>> We have to replace 'wordcount' with "wordcount" to make it work.
>>
>>
>> This becomes really problematic when we have large expressions with
>> several
>> single-quotes such as:
>>
>>
>> <case
>> to="end_1">${fs:exists(concat(concat(concat(concat(concat(nameNode,'/user/'),wf:user()),'/'),wf:conf('outputDir')),'/streaming/part-00000'))
>> and
>> (fs:fileSize(concat(concat(concat(concat(concat(nameNode,'/user/'),wf:user()),'/'),wf:conf('outputDir')),'/streaming/part-00000'))
>> gt 0) == "true"}</case>
>>
>> --
>> Thanks,
>> Params
>>
>> On Fri, Oct 14, 2011 at 9:36 AM, Alejandro Abdelnur <[email protected]
>> >wrote:
>>
>> > They answered that is a feature :)
>> >
>> > So the workaround is to do:
>> >
>> > ----
>> > #set( $D = '$' )
>> >
>> > ...
>> >
>> > ${D}{foo:bar}
>> > ----
>> >
>> > Quite ugly I'd say as we would have that all over the docs ${D} instead
>> > just
>> > $.
>> >
>> > The options are:
>> >
>> > 1* ${D} for $
>> > 2* Use $. for $ and we do a post-processing of the docs to do
>> 's/$\./$/g'
>> >
>> > I'm fine with both of them, and more incline to #2.
>> >
>> > Thoughts?
>> >
>> > Thanks.
>> >
>> > Alejandro
>> >
>> >
>> > On Fri, Oct 14, 2011 at 2:07 AM, Params <[email protected]> wrote:
>> >
>> > > Hi,
>> > >
>> > > I created a JIRA ticket for this issue in the Maven DOXIA project.
>> > > The url is: http://jira.codehaus.org/browse/DOXIA-447
>> > >
>> > > There seems to be some recent activity in the apt-dev (
>> > > http://jira.codehaus.org/browse/DOXIA). So, I hope that ours would be
>> > > looked
>> > > at soon.
>> > >
>> > > --
>> > > params
>> > >
>> > > On Thu, Oct 13, 2011 at 5:24 PM, Mohammad Islam <[email protected]>
>> > > wrote:
>> > >
>> > > > Hi Params,
>> > > > Would you pls create a JIRA for APT and let us know the JIRA id?
>> > > >
>> > > > Hi Alejandro,
>> > > > I think Param already found a (not-clean) workaround. Based on that,
>> do
>> > > you
>> > > > think we should go ahead with APT? How active is APT dev? I propose
>> to
>> > do
>> > > > APT for all new apache site documentation and then  we could go for
>> > twiki
>> > > to
>> > > > APT conversion of our existing doc.
>> > > > Any thoughts?
>> > > >
>> > > > Regards,
>> > > > Mohammad
>> > > >
>> > > >
>> > > >
>> > > > ________________________________
>> > > > From: Alejandro Abdelnur <[email protected]>
>> > > > To: [email protected]
>> > > > Sent: Tuesday, October 11, 2011 3:43 PM
>> > > > Subject: Re: Oozie documentation in Apache using APT
>> > > >
>> > > > Param,
>> > > >
>> > > > ${foo} works
>> > > > ${foo()} fails
>> > > > ${foo:bar} fails
>> > > > ${foo:bar()} fails
>> > > >
>> > > > Adding a '.' after the '$' works.
>> > > >
>> > > > It seems like a but in the doxia APT compiler.
>> > > >
>> > > > A bug should be filed against the doxia site plugin.
>> > > >
>> > > > Thanks.
>> > > >
>> > > > Alejandro
>> > > >
>> > > > On Tue, Oct 11, 2011 at 2:48 PM, Params <[email protected]>
>> wrote:
>> > > >
>> > > > > Hi Alejandro,
>> > > > >
>> > > > > That also fails. The problem seems to be more with the
>> > > > > ${wf:errorCode('wordcount')} kind of expressions than the verbatim
>> > > > > syntax/style.
>> > > > >
>> > > > > 1) Irrespective of using --------- or +--------+, I *get* the same
>> > > > > exception
>> > > > > on adding an expression like ${wf:errorCode('wordcount')} inside
>> the
>> > > xml.
>> > > > > 2) Irrespective of using --------- or +--------+, I *do not get*
>> any
>> > > > > exception on adding an expression like ${project.version}  inside
>> the
>> > > > xml.
>> > > > >
>> > > > > *Sample:*
>> > > > >
>> > > > >
>> > > > >
>> > > >
>> > >
>> >
>> +-------------------------------------------------------------------------------------+
>> > > > > <configuration>
>> > > > >        <property>
>> > > > >            <name>project.version</name>
>> > > > >            <value>${project.version}</value>
>> > > > >   //WORKS FINE
>> > > > >         </property>
>> > > > >        <property>
>> > > > >            <name>error.message</name>
>> > > > >             <value>${wf:errorCode('wordcount')}'</value>
>> > > > > //ERROR
>> > > > >        </property>
>> > > > > </configuration>
>> > > > >
>> > > > >
>> > > >
>> > >
>> >
>> +--------------------------------------------------------------------------------------+
>> > > > >
>> > > > > *Exception thrown clearly mentions - *[ERROR]
>> > > > > org.apache.velocity.exception.ParseErrorException: Encountered
>> > > > > ":errorCode(\'wordcount\')}\'</value>
>> > > > >
>> > > > > --
>> > > > > Thanks,
>> > > > > Params
>> > > > >
>> > > > >
>> > > > > On Tue, Oct 11, 2011 at 1:29 PM, Alejandro Abdelnur <
>> > [email protected]
>> > > > > >wrote:
>> > > > >
>> > > > > > Mohammad,
>> > > > > >
>> > > > > > Would you try the following syntax for snippets:
>> > > > > >
>> > > > > > +---+
>> > > > > >  ...
>> > > > > >  <dependency>
>> > > > > >      <groupId>com.cloudera.hoop</groupId>
>> > > > > >      <artifactId>hoop-client</artifactId>
>> > > > > >      <version>${project.version}</version>
>> > > > > >  </dependency>
>> > > > > >  ...
>> > > > > > +---+
>> > > > > >
>> > > > > > Thanks.
>> > > > > >
>> > > > > > Alejandro
>> > > > > >
>> > > > > > On Tue, Oct 11, 2011 at 1:19 PM, Params <[email protected]>
>> > wrote:
>> > > > > >
>> > > > > > > Hi,
>> > > > > > >
>> > > > > > > Following are the details of the issue we ran into:
>> > > > > > >
>> > > > > > > *Description:*
>> > > > > > > I tried to add the following snippet of xml into my .apt
>> source
>> > > file
>> > > > > > inside
>> > > > > > > a 'verbatim' block.
>> > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>> --------------------------------------------------------------------------------------------
>> > > > > > > <configuration>
>> > > > > > >        <property>
>> > > > > > >            <name>mapred.job.queue.name</name>
>> > > > > > >            <value>${queueName}</value>
>> > > > > > >        </property>
>> > > > > > >        <property>
>> > > > > > >            <name>error.message</name>
>> > > > > > >            <value>Something went wrong:
>> > > > > > > ${wf:errorCode('wordcount')}</value>
>> > > > > > >        </property>
>> > > > > > > </configuration>
>> > > > > > >
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>> --------------------------------------------------------------------------------------------
>> > > > > > >
>> > > > > > > On trying to build the maven project for the site
>> documentation,
>> > > > > > > $ mvn site
>> > > > > > >
>> > > > > > > I get the following error:
>> > > > > > >
>> > > > > > > [ERROR] org.apache.velocity.runtime.parser.ParseException:
>> > > > Encountered
>> > > > > > > ":errorCode(\'wordcount\')}</message>\n    </kill/>\n    <end
>> > > > > > >
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>> name=\'end\'/>\n</workflow-app>\n----------------------------------------------------------------------------------\n\n
>> > > > > > >  <<Notes:>>\n\n  <<" at line 134, column 44.
>> > > > > > > Was expecting one of:
>> > > > > > >    "}" ...
>> > > > > > >    <DOT> ...
>> > > > > > >
>> > > > > > >
>> > > > > > > Observations:
>> > > > > > > 1) It appears that whenever I use any text of the format:
>> > > > > > > ${wf:errorCode('wordcount')} , APT throws a parse exception
>> (even
>> > > if
>> > > > > its
>> > > > > > > contained in the verbatim block).
>> > > > > > >
>> > > > > > > 2) Other text like ${queueName} seems to work well.
>> > > > > > >
>> > > > > > > 3) I tried escaping the characters - {, $, :, etc.. but it
>> doesnt
>> > > > work
>> > > > > > > either.
>> > > > > > >
>> > > > > > > 4) I tried using the APT Editor (Eclipse plugin). It does not
>> > give
>> > > > any
>> > > > > > > errors on preview, but publishing the .apt using a 'mvn site'
>> > still
>> > > > > > fails.
>> > > > > > >
>> > > > > > > *Workaround (based on response from the maven nabble forum):*
>> > > > > > > Source:
>> > > > > > >
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>> http://maven.40175.n5.nabble.com/APT-Issue-with-adding-xml-code-snippets-as-Verbatim-tt4831524.html#a4831572
>> > > > > > >
>> > > > > > > The idea is to assign the "complex" value to a variable, next
>> > print
>> > > > > that
>> > > > > > > variable:
>> > > > > > > <value>#set($varline = '${wf:errorCode("wordcount")}')
>> > > > > >  ${varline}</value>
>> > > > > > >
>> > > > > > > However, the display text I now get on the html page is:
>> > > > > > > <value>  ${wf:errorCode("wordcount")}</value>
>> > > > > > >
>> > > > > > > This is not exactly the output we desire, we would prefer the
>> > > > wordcount
>> > > > > > to
>> > > > > > > appear inside single-quotes (in the html file generated) as:
>> > > > > > > ${wf:errorCode('wordcount')}
>> > > > > > >
>> > > > > > > The three following combinations (of the workaround described)
>> > > don't
>> > > > > work
>> > > > > > > (fail while running the mvn build):
>> > > > > > > <value>#set($varline = '${wf:errorCode(\'wordcount\')}')
>> > > > > > >  ${varline}</value>
>> > > > > > > <value>#set($varline = "${wf:errorCode('wordcount')}")
>> > > > > >  ${varline}</value>
>> > > > > > > <value>#set($varline = "${wf:errorCode(\'wordcount\')}")
>> > > > > > >  ${varline}</value>
>> > > > > > >
>> > > > > > > To summarize, it appears that there could be such other issues
>> as
>> > > > well
>> > > > > in
>> > > > > > > the future (with other APT document elements) that could slow
>> > down
>> > > > the
>> > > > > > > documentation process. It would be a good idea to assess the
>> > > > > capabilities
>> > > > > > > and shortcomings of APT. We also found that the doxia mailing
>> > lists
>> > > (
>> > > > > > > [email protected] and
>> > > doxia-dev-subscribe@maven
>> > > > > > > .apache.org) have been shutdown and merged into the main
>> maven
>> > > list:
>> > > > > > > http://maven.40175.n5.nabble.com/
>> > > > > > >
>> > > > > > > Please let me know if any more information is required.
>> > > > > > > --
>> > > > > > > Thanks,
>> > > > > > > Params
>> > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > > > On Tue, Oct 11, 2011 at 12:33 PM, Mohammad Islam <
>> > > [email protected]
>> > > > >
>> > > > > > > wrote:
>> > > > > > >
>> > > > > > > > Hi,
>> > > > > > > > As previously discussed, we did a POC using APT based
>> > > documentation
>> > > > (
>> > > > > > > > http://maven.apache.org/doxia/references/apt-format.html).
>> > > > > > > > In short, we found APT is very simple and easy to use.
>> > > > > > > > However, at least in one common case, we didn't find any
>> good
>> > way
>> > > > of
>> > > > > > > > writing the EL functions.
>> > > > > > > > (@Params: Would you please provide more details of the
>> issue?).
>> > > > > > > >
>> > > > > > > > Please give your comments on the followings:
>> > > > > > > > * Should we continue to use APT? Is there any other better
>> > option
>> > > > > > > > available?
>> > > > > > > >
>> > > > > > > > * Should we move our existing official Oozie doc from twiki
>> to
>> > > APT
>> > > > as
>> > > > > > > well?
>> > > > > > > > Currently we plan to adopt the new documentation framework
>> for
>> > > > Apache
>> > > > > > > Oozie
>> > > > > > > > site.
>> > > > > > > >
>> > > > > > > >
>> > > > > > > > Regards,
>> > > > > > > > Mohammad
>> > > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > > > --
>> > > > > > > params
>> > > > > > >
>> > > > > >
>> > > > >
>> > > > >
>> > > > >
>> > > > > --
>> > > > > params
>> > > > >
>> > > >
>> > >
>> >
>>
>>
>>
>> --
>> params
>>
>
>

Reply via email to