Re: [Dev] How to get the Maven project version into a shell script?

2018-04-18 Thread Me, Myself and I
I use the exec in the following way:

version=$(mvn -q -Dexec.executable=‘echo’ -Dexec.args=‘${project.version}’ 
--non-recursive exec:exec)

I hope this helps,

> On Apr 18, 2018, at 02:12, Thishani Lucas  wrote:
> 
> Hi Nipuni,
> 
> Is it feasible to read the property directly from the file system? For 
> example, we can get the project version from the file 
> META-INF/maven/${groupId}/${artifactId}/pom.properties of the jar.
> 
>> On Wed, Apr 18, 2018 at 11:06 AM, Nipuni Bhagya  wrote:
>> Hi,
>> 
>> Thanks for the quick response. 
>> 
>>> If you can run the shell script as a step in maven process, you can easily 
>>> pass the ${project.version} using exec-maven-plugin
>> 
>> Hi Amalka,
>> 
>> The issue is we run the script after maven process.
>>  
 You can use xmlstarlet to read the version of the project without adding a 
 maven plugin to POM file. I used this to read XML values in the command 
 line. An example can be found here [2]
 
 [1]: http://xmlstar.sourceforge.net/doc/UG/xmlstarlet-ug.html
 [2]: https://stackoverflow.com/questions/12640152/xmlstarlet-select-value
>> 
>> Hi Abimaran,
>> 
>> It was initially decided not to use any external tools for this task. So we 
>> will need an approach which does not require any external XML tools.
>> 
>> -- 
>> Kind Regards,
>> 
>> Nipuni Bhagya
>> Software Engineering Intern
>> WSO2
>> Mobile : +94 0779028904
>> 
>> 
>> 
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>> 
> 
> 
> 
> -- 
> Regards,
> 
> Thishani Lucas
> Software Engineer 
> WSO2 Lanka (Private) Limited: http://wso2.com
> lean.enterprise.middle-ware
> 
> Tel: +94 77 2556931 
> LinkedIn: https://www.linkedin.com/in/thishani-lucas/
> 
> 
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] How to get the Maven project version into a shell script?

2018-04-18 Thread Thishani Lucas
Hi Nipuni,

Is it feasible to read the property directly from the file system? For
example, we can get the project version from the file META-INF/maven/${
groupId}/${artifactId}/pom.properties of the jar.

On Wed, Apr 18, 2018 at 11:06 AM, Nipuni Bhagya  wrote:

> Hi,
>
> Thanks for the quick response.
>
> If you can run the shell script as a step in maven process, you can easily
>> pass the ${project.version} using exec-maven-plugin
>>
>
> Hi Amalka,
>
> The issue is we run the script after maven process.
>
>
>> You can use xmlstarlet to read the version of the project without adding
>>> a maven plugin to POM file. I used this to read XML values in the command
>>> line. An example can be found here [2]
>>>
>>> [1]: http://xmlstar.sourceforge.net/doc/UG/xmlstarlet-ug.html
>>> [2]: https://stackoverflow.com/questions/12640152/xmlstarlet
>>> -select-value
>>>
>>
> Hi Abimaran,
>
> It was initially decided not to use any external tools for this task. So
> we will need an approach which does not require any external XML tools.
>
> --
>
>
>
> *Kind Regards,Nipuni Bhagya*
>
> *Software Engineering Intern*
> *WSO2*
>
>
>
> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Regards,

*Thishani Lucas*
*Software Engineer*
*WSO2 Lanka (Private) Limited**: http://wso2.com *
*lean.enterprise.middle-ware*

*Tel: +94 77 2556931 *

*LinkedIn: https://www.linkedin.com/in/thishani-lucas/
*


___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] How to get the Maven project version into a shell script?

2018-04-17 Thread Nipuni Bhagya
Hi,

Thanks for the quick response.

If you can run the shell script as a step in maven process, you can easily
> pass the ${project.version} using exec-maven-plugin
>

Hi Amalka,

The issue is we run the script after maven process.


> You can use xmlstarlet to read the version of the project without adding a
>> maven plugin to POM file. I used this to read XML values in the command
>> line. An example can be found here [2]
>>
>> [1]: http://xmlstar.sourceforge.net/doc/UG/xmlstarlet-ug.html
>> [2]: https://stackoverflow.com/questions/12640152/xmlstarlet-select-value
>>
>
Hi Abimaran,

It was initially decided not to use any external tools for this task. So we
will need an approach which does not require any external XML tools.

-- 



*Kind Regards,Nipuni Bhagya*

*Software Engineering Intern*
*WSO2*



*Mobile : +94 0779028904 <+94%2077%20767%201807>*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] How to get the Maven project version into a shell script?

2018-04-17 Thread Amalka Subasinghe
If you can run the shell script as a step in maven process, you can easily
pass the ${project.version} using exec-maven-plugin

On Wed, Apr 18, 2018 at 9:36 AM, Abimaran Kugathasan 
wrote:

> Hi Nipuni,
>
> You can use xmlstarlet to read the version of the project without adding
> a maven plugin to POM file. I used this to read XML values in the command
> line. An example can be found here [2]
>
> [1]: http://xmlstar.sourceforge.net/doc/UG/xmlstarlet-ug.html
> [2]: https://stackoverflow.com/questions/12640152/xmlstarlet-select-value
>
> On Tue, Apr 17, 2018 at 2:37 PM, Nipuni Bhagya  wrote:
>
>> Hi all,
>>
>> I have encountered a problem while trying to get the version number of a
>> jar into a shell script. Currently, the name of the jar is hardcoded in the
>> script. But the problem is when the maven version get updated in the
>> project it should reflect in the script. The closest solution I have come
>> up at the moment is to use the Maven Help Plugin
>> . The
>> goal help:evaluate can evaluate Maven expression,
>> -Dexpression=project.version and then I can grep the version from its
>> result.
>>
>> I would really appreciate if someone of you could help me to find a
>> better way to achieve this task.
>>
>> Thank you in advance,
>>
>> --
>>
>>
>>
>> *Kind Regards,Nipuni Bhagya*
>>
>> *Software Engineering Intern*
>> *WSO2*
>>
>>
>>
>> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Thanks
> Abimaran Kugathasan
> Senior Software Engineer - API Technologies
>
> Email : abima...@wso2.com
> Mobile : +94 773922820
>
> 
> 
>   
> 
>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Amalka Subasinghe

WSO2 Inc. https://wso2.com/
Mobile: +94 77 9401267
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] How to get the Maven project version into a shell script?

2018-04-17 Thread Abimaran Kugathasan
Hi Nipuni,

You can use xmlstarlet to read the version of the project without adding a
maven plugin to POM file. I used this to read XML values in the command
line. An example can be found here [2]

[1]: http://xmlstar.sourceforge.net/doc/UG/xmlstarlet-ug.html
[2]: https://stackoverflow.com/questions/12640152/xmlstarlet-select-value

On Tue, Apr 17, 2018 at 2:37 PM, Nipuni Bhagya  wrote:

> Hi all,
>
> I have encountered a problem while trying to get the version number of a
> jar into a shell script. Currently, the name of the jar is hardcoded in the
> script. But the problem is when the maven version get updated in the
> project it should reflect in the script. The closest solution I have come
> up at the moment is to use the Maven Help Plugin
> . The
> goal help:evaluate can evaluate Maven expression,
> -Dexpression=project.version and then I can grep the version from its
> result.
>
> I would really appreciate if someone of you could help me to find a better
> way to achieve this task.
>
> Thank you in advance,
>
> --
>
>
>
> *Kind Regards,Nipuni Bhagya*
>
> *Software Engineering Intern*
> *WSO2*
>
>
>
> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Thanks
Abimaran Kugathasan
Senior Software Engineer - API Technologies

Email : abima...@wso2.com
Mobile : +94 773922820


  
  
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] How to get the Maven project version into a shell script?

2018-04-17 Thread Nipuni Bhagya
Hi all,

I have encountered a problem while trying to get the version number of a
jar into a shell script. Currently, the name of the jar is hardcoded in the
script. But the problem is when the maven version get updated in the
project it should reflect in the script. The closest solution I have come
up at the moment is to use the Maven Help Plugin
. The
goal help:evaluate can evaluate Maven expression,
-Dexpression=project.version and then I can grep the version from its
result.

I would really appreciate if someone of you could help me to find a better
way to achieve this task.

Thank you in advance,

-- 



*Kind Regards,Nipuni Bhagya*

*Software Engineering Intern*
*WSO2*



*Mobile : +94 0779028904 <+94%2077%20767%201807>*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev