You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Andrew Hunt <An...@nab.com.au> on 2011/10/26 00:27:21 UTC

maven-resources-plugin not retaining unix permissions?

Hi

I have a project in which our run scripts are in src/main/resources/.  The code is in a GIT repo and I found out how to set the file permission include execute permission in GIT.
$ ls -l src/main/resources/
total 60
-rw-r-----  1 svc_fx_build APP_Repo_Users 16097 Oct 24 15:47 change_readme.docx
-rwxr-x---  1 svc_fx_build APP_Repo_Users 18763 Oct 25 09:55 db.build.package.pl
drwxr-x--- 12 svc_fx_build APP_Repo_Users  4096 Sep 19 08:00 oracle
-rwxr-x---  1 svc_fx_build APP_Repo_Users    65 Oct 25 09:55 sqlplus.cmd

However, after running mvn clean install, the files are copied to target/classes as
$ ls -l target/classes
total 60
-rw-r-----  1 svc_fx_build APP_Repo_Users 16097 Oct 24 15:47 change_readme.docx
-rw-r-----  1 svc_fx_build APP_Repo_Users 18763 Oct 25 09:55 db.build.package.pl
drwxr-x--- 12 svc_fx_build APP_Repo_Users  4096 Sep 19 08:00 oracle
-rw-r-----  1 svc_fx_build APP_Repo_Users    65 Oct 25 09:55 sqlplus.cmd

I noticed an issue for this in the "resources:test-resources" [http://jira.codehaus.org/browse/MRESOURCES-132] phase/goal - but on the face of it, this issue also applies to "resources:resources" and "resources:copy-resources".  Or is there configuration somewhere I am missing/ need to add?  Have I structured things poorly?  If not, do you have a FAQ for getting access to JIRA to update / create a new issue [must be blind - I cannot find it sorry]?

[FYI - We need the permissions set as the script is executed as part of our release].  I am using an ANT workaround for now.

Thanks...Andrew (Forum newbie)
P Please consider the environment before printing this e-mail


________________________________
The information contained in this email communication may be confidential. If you have received this email in error, please notify the sender by return email, delete this email and destroy any copy.
Any advice contained in this email has been prepared without taking into account your objectives, financial situation or needs. Before acting on any advice in this email, National Australia Bank Limited (NAB) recommends that you consider whether it is appropriate for your circumstances. If this email contains reference to any financial products, NAB recommends you consider the Product Disclosure Statement (PDS) or other disclosure document available from NAB, before making any decisions regarding any products.
If this email contains any promotional content that you do not wish to receive, please reply to the original sender and write "Don't email promotional material" in the subject.

Re: maven-resources-plugin not retaining unix permissions?

Posted by Barrie Treloar <ba...@gmail.com>.
On Wed, Oct 26, 2011 at 8:57 AM, Andrew Hunt <An...@nab.com.au> wrote:
> Hi
>
> I have a project in which our run scripts are in src/main/resources/.  The code is in a GIT repo and I found out how to set the file permission include execute permission in GIT.
> $ ls -l src/main/resources/
> total 60
> -rw-r-----  1 svc_fx_build APP_Repo_Users 16097 Oct 24 15:47 change_readme.docx
> -rwxr-x---  1 svc_fx_build APP_Repo_Users 18763 Oct 25 09:55 db.build.package.pl
> drwxr-x--- 12 svc_fx_build APP_Repo_Users  4096 Sep 19 08:00 oracle
> -rwxr-x---  1 svc_fx_build APP_Repo_Users    65 Oct 25 09:55 sqlplus.cmd
>
> However, after running mvn clean install, the files are copied to target/classes as
> $ ls -l target/classes
> total 60
> -rw-r-----  1 svc_fx_build APP_Repo_Users 16097 Oct 24 15:47 change_readme.docx
> -rw-r-----  1 svc_fx_build APP_Repo_Users 18763 Oct 25 09:55 db.build.package.pl
> drwxr-x--- 12 svc_fx_build APP_Repo_Users  4096 Sep 19 08:00 oracle
> -rw-r-----  1 svc_fx_build APP_Repo_Users    65 Oct 25 09:55 sqlplus.cmd
>
> I noticed an issue for this in the "resources:test-resources" [http://jira.codehaus.org/browse/MRESOURCES-132] phase/goal - but on the face of it, this issue also applies to "resources:resources" and "resources:copy-resources".  Or is there configuration somewhere I am missing/ need to add?  Have I structured things poorly?  If not, do you have a FAQ for getting access to JIRA to update / create a new issue [must be blind - I cannot find it sorry]?
>
> [FYI - We need the permissions set as the script is executed as part of our release].  I am using an ANT workaround for now.

Did you see the email about three messages back titled
"Is there a workaround for this bug:
http://jira.codehaus.org/browse/MRESOURCES-132"

I'll quote Stephen
On Wed, Oct 26, 2011 at 2:25 AM, Stephen Connolly
<st...@gmail.com> wrote:
> How would such a build work on windows?
>
> When those resources get bundled up in a jar, there will not be
> execute permissions reflected in the jar.
>
> IOW the jar command does not store the extended permissions
> information that a zip file can hold.
>
> If you are looking to create zip files with extended permissions I
> would recommend using the assembly plugin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: maven-resources-plugin not retaining unix permissions?

Posted by Andrew Hunt <An...@nab.com.au>.
Alexander
My work around is almost identical to yours - the chief difference being the phase - I are using
<phase>process-resources</phase>.

Jason
Was not aware of the creation purpose.  The assembly plug-in appears to be a tad too heavy for what we need, in that the file we need permissions set on is executed as part of the packaging to generate an input file for Oracle's SQLPlus based on the files present.  It (the generation script) does not end up in the resultant set of files.

We'll stick with the "Work Around" - I'll just internally document it differently (and remember for next time).

Thanks for all your responses.

...Andrew
Please consider the environment before printing this e-mail

-----Original Message-----
From: Jason van Zyl [mailto:jason@tesla.io]
Sent: Wednesday, 26 October 2011 9:28 PM
To: Maven Users List
Subject: Re: maven-resources-plugin not retaining unix permissions?

The maven-resources-plugin was never intended to create any resources that would be used in a naked filesystem. It was strictly intended to place resources into the resultant artifact for use in a platform independent way, in general from the classpath. If you want to move archives around that are going to be unpacked and used I suggest the assembly plugin for making the archives and the dependency plugin for unpacking them.

On Oct 26, 2011, at 3:41 AM, Alexander Poulikakos wrote:

> Hi
>
> What does your workaround look like?
>
> We also have this same problem. The workaround we use is adding this in the pom.xml:
>
> <plugin>
>    <groupId>org.apache.maven.plugins</groupId>
>    <artifactId>maven-antrun-plugin</artifactId>
>    <version>1.6</version>
>    <executions>
>        <execution>
>            <id>process-classes</id>
>            <phase>process-classes</phase>
>            <configuration>
>                <target>
>                    <chmod file="target/classes/<any-file>" perm="755"/>
>                </target>
>            </configuration>
>            <goals>
>                <goal>run</goal>
>            </goals>
>        </execution>
>    </executions>
> </plugin>
>
Are there any better workarounds out there? Or preferable some setting that can be done on maven-resources-plugin?
>
> /Alex


The information contained in this email communication may be confidential. If you have received this email in error, please notify the sender by return email, delete this email and destroy any copy.
Any advice contained in this email has been prepared without taking into account your objectives, financial situation or needs. Before acting on any advice in this email, National Australia Bank Limited (NAB) recommends that you consider whether it is appropriate for your circumstances. If this email contains reference to any financial products, NAB recommends you consider the Product Disclosure Statement (PDS) or other disclosure document available from NAB, before making any decisions regarding any products.
If this email contains any promotional content that you do not wish to receive, please reply to the original sender and write "Don't email promotional material" in the subject.

Re: maven-resources-plugin not retaining unix permissions?

Posted by Jason van Zyl <ja...@tesla.io>.
The maven-resources-plugin was never intended to create any resources that would be used in a naked filesystem. It was strictly intended to place resources into the resultant artifact for use in a platform independent way, in general from the classpath. If you want to move archives around that are going to be unpacked and used I suggest the assembly plugin for making the archives and the dependency plugin for unpacking them.

On Oct 26, 2011, at 3:41 AM, Alexander Poulikakos wrote:

> Hi 
> 
> What does your workaround look like? 
> 
> We also have this same problem. The workaround we use is adding this in the pom.xml:
> 
> <plugin>
>    <groupId>org.apache.maven.plugins</groupId>
>    <artifactId>maven-antrun-plugin</artifactId>
>    <version>1.6</version>
>    <executions>
>        <execution>
>            <id>process-classes</id>
>            <phase>process-classes</phase>
>            <configuration>
>                <target>
>                    <chmod file="target/classes/<any-file>" perm="755"/>
>                </target>
>            </configuration>
>            <goals>
>                <goal>run</goal>
>            </goals>
>        </execution>
>    </executions>
> </plugin>
> 
> Are there any better workarounds out there? Or preferable some setting that can be done on maven-resources-plugin?
> 
> /Alex
> 
> 
> 
> -----Original Message-----
> From: Andrew Hunt [mailto:Andrew.Hunt@nab.com.au] 
> Sent: den 26 oktober 2011 00:27
> To: users@maven.apache.org
> Subject: maven-resources-plugin not retaining unix permissions?
> 
> Hi
> 
> I have a project in which our run scripts are in src/main/resources/.  The code is in a GIT repo and I found out how to set the file permission include execute permission in GIT.
> $ ls -l src/main/resources/
> total 60
> -rw-r-----  1 svc_fx_build APP_Repo_Users 16097 Oct 24 15:47 change_readme.docx
> -rwxr-x---  1 svc_fx_build APP_Repo_Users 18763 Oct 25 09:55 db.build.package.pl
> drwxr-x--- 12 svc_fx_build APP_Repo_Users  4096 Sep 19 08:00 oracle
> -rwxr-x---  1 svc_fx_build APP_Repo_Users    65 Oct 25 09:55 sqlplus.cmd
> 
> However, after running mvn clean install, the files are copied to target/classes as
> $ ls -l target/classes
> total 60
> -rw-r-----  1 svc_fx_build APP_Repo_Users 16097 Oct 24 15:47 change_readme.docx
> -rw-r-----  1 svc_fx_build APP_Repo_Users 18763 Oct 25 09:55 db.build.package.pl
> drwxr-x--- 12 svc_fx_build APP_Repo_Users  4096 Sep 19 08:00 oracle
> -rw-r-----  1 svc_fx_build APP_Repo_Users    65 Oct 25 09:55 sqlplus.cmd
> 
> I noticed an issue for this in the "resources:test-resources" [http://jira.codehaus.org/browse/MRESOURCES-132] phase/goal - but on the face of it, this issue also applies to "resources:resources" and "resources:copy-resources".  Or is there configuration somewhere I am missing/ need to add?  Have I structured things poorly?  If not, do you have a FAQ for getting access to JIRA to update / create a new issue [must be blind - I cannot find it sorry]?
> 
> [FYI - We need the permissions set as the script is executed as part of our release].  I am using an ANT workaround for now.
> 
> Thanks...Andrew (Forum newbie)
> P Please consider the environment before printing this e-mail
> 
> 
> ________________________________
> The information contained in this email communication may be confidential. If you have received this email in error, please notify the sender by return email, delete this email and destroy any copy.
> Any advice contained in this email has been prepared without taking into account your objectives, financial situation or needs. Before acting on any advice in this email, National Australia Bank Limited (NAB) recommends that you consider whether it is appropriate for your circumstances. If this email contains reference to any financial products, NAB recommends you consider the Product Disclosure Statement (PDS) or other disclosure document available from NAB, before making any decisions regarding any products.
> If this email contains any promotional content that you do not wish to receive, please reply to the original sender and write "Don't email promotional material" in the subject.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.

  -- Jacques Ellul, The Technological Society





RE: maven-resources-plugin not retaining unix permissions?

Posted by Alexander Poulikakos <al...@ericsson.com>.
Hi 

What does your workaround look like? 

We also have this same problem. The workaround we use is adding this in the pom.xml:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.6</version>
    <executions>
        <execution>
            <id>process-classes</id>
            <phase>process-classes</phase>
            <configuration>
                <target>
                    <chmod file="target/classes/<any-file>" perm="755"/>
                </target>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Are there any better workarounds out there? Or preferable some setting that can be done on maven-resources-plugin?

/Alex



-----Original Message-----
From: Andrew Hunt [mailto:Andrew.Hunt@nab.com.au] 
Sent: den 26 oktober 2011 00:27
To: users@maven.apache.org
Subject: maven-resources-plugin not retaining unix permissions?

Hi

I have a project in which our run scripts are in src/main/resources/.  The code is in a GIT repo and I found out how to set the file permission include execute permission in GIT.
$ ls -l src/main/resources/
total 60
-rw-r-----  1 svc_fx_build APP_Repo_Users 16097 Oct 24 15:47 change_readme.docx
-rwxr-x---  1 svc_fx_build APP_Repo_Users 18763 Oct 25 09:55 db.build.package.pl
drwxr-x--- 12 svc_fx_build APP_Repo_Users  4096 Sep 19 08:00 oracle
-rwxr-x---  1 svc_fx_build APP_Repo_Users    65 Oct 25 09:55 sqlplus.cmd

However, after running mvn clean install, the files are copied to target/classes as
$ ls -l target/classes
total 60
-rw-r-----  1 svc_fx_build APP_Repo_Users 16097 Oct 24 15:47 change_readme.docx
-rw-r-----  1 svc_fx_build APP_Repo_Users 18763 Oct 25 09:55 db.build.package.pl
drwxr-x--- 12 svc_fx_build APP_Repo_Users  4096 Sep 19 08:00 oracle
-rw-r-----  1 svc_fx_build APP_Repo_Users    65 Oct 25 09:55 sqlplus.cmd

I noticed an issue for this in the "resources:test-resources" [http://jira.codehaus.org/browse/MRESOURCES-132] phase/goal - but on the face of it, this issue also applies to "resources:resources" and "resources:copy-resources".  Or is there configuration somewhere I am missing/ need to add?  Have I structured things poorly?  If not, do you have a FAQ for getting access to JIRA to update / create a new issue [must be blind - I cannot find it sorry]?

[FYI - We need the permissions set as the script is executed as part of our release].  I am using an ANT workaround for now.

Thanks...Andrew (Forum newbie)
P Please consider the environment before printing this e-mail


________________________________
The information contained in this email communication may be confidential. If you have received this email in error, please notify the sender by return email, delete this email and destroy any copy.
Any advice contained in this email has been prepared without taking into account your objectives, financial situation or needs. Before acting on any advice in this email, National Australia Bank Limited (NAB) recommends that you consider whether it is appropriate for your circumstances. If this email contains reference to any financial products, NAB recommends you consider the Product Disclosure Statement (PDS) or other disclosure document available from NAB, before making any decisions regarding any products.
If this email contains any promotional content that you do not wish to receive, please reply to the original sender and write "Don't email promotional material" in the subject.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: maven-resources-plugin not retaining unix permissions?

Posted by Mark Derricutt <ma...@talios.com>.
Good to be corrected.  There was a time a way back that it didn't even
preserve that, at least not when checking out.  You'd checkout and find you
instantly have "modified files".

-- 
"Great artists are extremely selfish and arrogant things" — Steven Wilson,
Porcupine Tree

On Thu, Oct 27, 2011 at 12:14 AM, Stuart McCulloch <mc...@gmail.com>wrote:

> technically git can preserve file modes in its data structure, but right
> now it only respects the execute bit (644 vs 755)

Re: maven-resources-plugin not retaining unix permissions?

Posted by Stuart McCulloch <mc...@gmail.com>.
On 26 Oct 2011, at 11:48, Mark Derricutt wrote:

> From memory git also doesn't support permissions as it tracks file CONTENTS
> only.

technically git can preserve file modes in its data structure, but right now it only respects the execute bit (644 vs 755)

> -- 
> "Great artists are extremely selfish and arrogant things" — Steven Wilson,
> Porcupine Tree
> 
> 
> On Wed, Oct 26, 2011 at 11:27 AM, Andrew Hunt <An...@nab.com.au>wrote:
> 
>> I have a project in which our run scripts are in src/main/resources/.  The
>> code is in a GIT repo and I found out how to set the file permission include
>> execute permission in GIT.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: maven-resources-plugin not retaining unix permissions?

Posted by Mark Derricutt <ma...@talios.com>.
>From memory git also doesn't support permissions as it tracks file CONTENTS
only.

-- 
"Great artists are extremely selfish and arrogant things" — Steven Wilson,
Porcupine Tree


On Wed, Oct 26, 2011 at 11:27 AM, Andrew Hunt <An...@nab.com.au>wrote:

> I have a project in which our run scripts are in src/main/resources/.  The
> code is in a GIT repo and I found out how to set the file permission include
> execute permission in GIT.