You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Don Corley (JIRA)" <ji...@codehaus.org> on 2010/01/15 11:39:56 UTC

[jira] Created: (MRESOURCES-116) maven-resources-plugin corrupts my class file on move

maven-resources-plugin corrupts my class file on move
-----------------------------------------------------

                 Key: MRESOURCES-116
                 URL: http://jira.codehaus.org/browse/MRESOURCES-116
             Project: Maven 2.x Resources Plugin
          Issue Type: Bug
    Affects Versions: 2.4.1
         Environment: Linux, jdk 1.6.0_17, maven 2.2.1
            Reporter: Don Corley
         Attachments: pom.xml

I'm trying to create a copy of my class files and they seem to get corrupted.

I'm new to maven, so maybe I'm not understanding how it works.

To recreate this bug, create the simple maven project:

mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.0 -DgroupId=com.example -DartifactId=zjar

Now, add this maven-resources-plugin from the http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html page to the pom.

Change the source directory to target/classes and the phase to package (since I want this to run after compile)

My new pom is attached.

Now,
cd target/extra-resources
java -cp . com.example.App

gives me Incompatible magic value error. The weird thing is the class in the target/classes directory is fine.

Thanks

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MRESOURCES-116) maven-resources-plugin corrupts my class file on move

Posted by "Don Corley (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MRESOURCES-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=210641#action_210641 ] 

Don Corley commented on MRESOURCES-116:
---------------------------------------

Actually I need to filter my byte code because I need the same class files in a web accessible location (/classes and /lib) and in the server class file location (WEB-INF/classes and WEB-INF/lib). My code runs in a servlet and as an applet on the client, so I need to duplicate the code. I'm sure there is an easier way, but I have not figured it out yet.
Thanks for the filtering tip... sounds like this is my problem.

> maven-resources-plugin corrupts my class file on move
> -----------------------------------------------------
>
>                 Key: MRESOURCES-116
>                 URL: http://jira.codehaus.org/browse/MRESOURCES-116
>             Project: Maven 2.x Resources Plugin
>          Issue Type: Bug
>    Affects Versions: 2.4.1
>         Environment: Linux, jdk 1.6.0_17, maven 2.2.1
>            Reporter: Don Corley
>         Attachments: pom.xml
>
>
> I'm trying to create a copy of my class files and they seem to get corrupted.
> I'm new to maven, so maybe I'm not understanding how it works.
> To recreate this bug, create the simple maven project:
> mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.0 -DgroupId=com.example -DartifactId=zjar
> Now, add this maven-resources-plugin from the http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html page to the pom.
> Change the source directory to target/classes and the phase to package (since I want this to run after compile)
> My new pom is attached.
> Now,
> cd target/extra-resources
> java -cp . com.example.App
> gives me Incompatible magic value error. The weird thing is the class in the target/classes directory is fine.
> Thanks

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MRESOURCES-116) maven-resources-plugin corrupts my class file on move

Posted by "Don Corley (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MRESOURCES-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=207042#action_207042 ] 

Don Corley commented on MRESOURCES-116:
---------------------------------------

Oh, I am using
mvn install
to build this project

> maven-resources-plugin corrupts my class file on move
> -----------------------------------------------------
>
>                 Key: MRESOURCES-116
>                 URL: http://jira.codehaus.org/browse/MRESOURCES-116
>             Project: Maven 2.x Resources Plugin
>          Issue Type: Bug
>    Affects Versions: 2.4.1
>         Environment: Linux, jdk 1.6.0_17, maven 2.2.1
>            Reporter: Don Corley
>         Attachments: pom.xml
>
>
> I'm trying to create a copy of my class files and they seem to get corrupted.
> I'm new to maven, so maybe I'm not understanding how it works.
> To recreate this bug, create the simple maven project:
> mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.0 -DgroupId=com.example -DartifactId=zjar
> Now, add this maven-resources-plugin from the http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html page to the pom.
> Change the source directory to target/classes and the phase to package (since I want this to run after compile)
> My new pom is attached.
> Now,
> cd target/extra-resources
> java -cp . com.example.App
> gives me Incompatible magic value error. The weird thing is the class in the target/classes directory is fine.
> Thanks

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MRESOURCES-116) maven-resources-plugin corrupts my class file on move

Posted by "Alexander Lutz (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MRESOURCES-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=210627#action_210627 ] 

Alexander Lutz commented on MRESOURCES-116:
-------------------------------------------

Hello,
 for me it seems a little weird: Why should someone want to filter byte code!?
Set <filtering>false</filtering> (or delete the <filtering/>-element), and I think it will work for you!
Cheers, Alex

> maven-resources-plugin corrupts my class file on move
> -----------------------------------------------------
>
>                 Key: MRESOURCES-116
>                 URL: http://jira.codehaus.org/browse/MRESOURCES-116
>             Project: Maven 2.x Resources Plugin
>          Issue Type: Bug
>    Affects Versions: 2.4.1
>         Environment: Linux, jdk 1.6.0_17, maven 2.2.1
>            Reporter: Don Corley
>         Attachments: pom.xml
>
>
> I'm trying to create a copy of my class files and they seem to get corrupted.
> I'm new to maven, so maybe I'm not understanding how it works.
> To recreate this bug, create the simple maven project:
> mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.0 -DgroupId=com.example -DartifactId=zjar
> Now, add this maven-resources-plugin from the http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html page to the pom.
> Change the source directory to target/classes and the phase to package (since I want this to run after compile)
> My new pom is attached.
> Now,
> cd target/extra-resources
> java -cp . com.example.App
> gives me Incompatible magic value error. The weird thing is the class in the target/classes directory is fine.
> Thanks

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MRESOURCES-116) maven-resources-plugin corrupts my class file on move

Posted by "Alexander Lutz (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MRESOURCES-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=210663#action_210663 ] 

Alexander Lutz commented on MRESOURCES-116:
-------------------------------------------

Hi Don,
now I understand the confusion. ["Filtering"|http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html] in terms of the maven-resources-plugin means:
 To replace quoted tokens from a "source" resource file by available Properties into the "target" resource file. Default quotations are ${...} and @...@ . The default use case looks like writing something like '${my.property}' into a resource file ..., calling mvn resources:resources -Dmy.property=xyz, resulting in: the target resource file contains 'xyz' (instead of ${my.property}).
..you think of "filtering" as "including or excluding something from the file system" (I'm OK with this formulation, but the documentation people still call it literally [Including and excluding files and directories|http://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html] ;))
Except from "filtering", you solved that problem well, I think. I don't know a "better" way to copy files, though an alternative: maven-antrun-plugin and its [copy task|http://ant.apache.org/manual/CoreTasks/copy.html]. Perhaps 1-2 hints for your pom: Bind the execution rather to "process-classes" than to the "package" phase. And prefer '${project.build.directory}' to '${basedir}/target' and '${project.build.outputDirectory}' to 'target/classes'.
Please also consider to close this issue!
Best regards, Alex

> maven-resources-plugin corrupts my class file on move
> -----------------------------------------------------
>
>                 Key: MRESOURCES-116
>                 URL: http://jira.codehaus.org/browse/MRESOURCES-116
>             Project: Maven 2.x Resources Plugin
>          Issue Type: Bug
>    Affects Versions: 2.4.1
>         Environment: Linux, jdk 1.6.0_17, maven 2.2.1
>            Reporter: Don Corley
>         Attachments: pom.xml
>
>
> I'm trying to create a copy of my class files and they seem to get corrupted.
> I'm new to maven, so maybe I'm not understanding how it works.
> To recreate this bug, create the simple maven project:
> mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.0 -DgroupId=com.example -DartifactId=zjar
> Now, add this maven-resources-plugin from the http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html page to the pom.
> Change the source directory to target/classes and the phase to package (since I want this to run after compile)
> My new pom is attached.
> Now,
> cd target/extra-resources
> java -cp . com.example.App
> gives me Incompatible magic value error. The weird thing is the class in the target/classes directory is fine.
> Thanks

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MRESOURCES-116) maven-resources-plugin corrupts my class file on move

Posted by "Don Corley (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MRESOURCES-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=210664#action_210664 ] 

Don Corley commented on MRESOURCES-116:
---------------------------------------

Yes, That did it.
You can close this ticket.
Thanks.

> maven-resources-plugin corrupts my class file on move
> -----------------------------------------------------
>
>                 Key: MRESOURCES-116
>                 URL: http://jira.codehaus.org/browse/MRESOURCES-116
>             Project: Maven 2.x Resources Plugin
>          Issue Type: Bug
>    Affects Versions: 2.4.1
>         Environment: Linux, jdk 1.6.0_17, maven 2.2.1
>            Reporter: Don Corley
>         Attachments: pom.xml
>
>
> I'm trying to create a copy of my class files and they seem to get corrupted.
> I'm new to maven, so maybe I'm not understanding how it works.
> To recreate this bug, create the simple maven project:
> mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.0 -DgroupId=com.example -DartifactId=zjar
> Now, add this maven-resources-plugin from the http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html page to the pom.
> Change the source directory to target/classes and the phase to package (since I want this to run after compile)
> My new pom is attached.
> Now,
> cd target/extra-resources
> java -cp . com.example.App
> gives me Incompatible magic value error. The weird thing is the class in the target/classes directory is fine.
> Thanks

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (MRESOURCES-116) maven-resources-plugin corrupts my class file on move

Posted by "Don Corley (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MRESOURCES-116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Don Corley closed MRESOURCES-116.
---------------------------------

    Resolution: Fixed

Had to turn filtering off

> maven-resources-plugin corrupts my class file on move
> -----------------------------------------------------
>
>                 Key: MRESOURCES-116
>                 URL: http://jira.codehaus.org/browse/MRESOURCES-116
>             Project: Maven 2.x Resources Plugin
>          Issue Type: Bug
>    Affects Versions: 2.4.1
>         Environment: Linux, jdk 1.6.0_17, maven 2.2.1
>            Reporter: Don Corley
>         Attachments: pom.xml
>
>
> I'm trying to create a copy of my class files and they seem to get corrupted.
> I'm new to maven, so maybe I'm not understanding how it works.
> To recreate this bug, create the simple maven project:
> mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.0 -DgroupId=com.example -DartifactId=zjar
> Now, add this maven-resources-plugin from the http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html page to the pom.
> Change the source directory to target/classes and the phase to package (since I want this to run after compile)
> My new pom is attached.
> Now,
> cd target/extra-resources
> java -cp . com.example.App
> gives me Incompatible magic value error. The weird thing is the class in the target/classes directory is fine.
> Thanks

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira