cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Grzegorz Grzybek (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CXF-5215) -Psetup.eclipse fails on Windows
Date Fri, 27 Sep 2013 08:28:06 GMT

    [ https://issues.apache.org/jira/browse/CXF-5215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13779767#comment-13779767
] 

Grzegorz Grzybek edited comment on CXF-5215 at 9/27/13 8:27 AM:
----------------------------------------------------------------

The problem is in {{org.apache.cxf.maven_plugin.AbstractCodegenMoho.checkResources()}} method,
in this fragment:
{code:java}
  genroot = getGeneratedTestRoot();
  if (genroot != null) {
      List<Resource> resources = project.getBuild().getTestResources();
      for (Resource r : resources) {
          File d = new File(root, r.getDirectory());
          if (d.equals(genroot)) {
              testRoot = r;
          } 
      }
      Resource r2 = scanForResources(genroot, testRoot);
      if (r2 != testRoot) {
          r2.setDirectory(getGeneratedTestRoot().getAbsolutePath());
          r2.setTargetPath(project.getBuild().getTestOutputDirectory());
          project.addTestResource(r2);
      }
  }
{code}

{{r2.setTargetPath(project.getBuild().getTestOutputDirectory());}} is wrong, because JavaDoc
for {{org.apache.maven.model.Resource.setTargetPath(String)}} says:
{noformat}
... The path is relative to the target/classes directory ...
{noformat}
(for test resources, the path is related to "target/test-classes" directory).

Setting the target path to {{project.getBuild().getTestOutputDirectory()}} (in my case: "C:\Dev\Git\projects-github-grgrzybek\cxf\systests\databinding\target\test-classes")
leads (much) later to the following (in maven-eclipse-plugin):
{code:java}
if ( !StringUtils.isEmpty( resource.getTargetPath() ) )
{
   outputFile = new File( "C:\Dev\Git\projects-github-grgrzybek\cxf\systests\databinding\target\test-classes",
"C:\Dev\Git\projects-github-grgrzybek\cxf\systests\databinding\target\test-classes" )
   ...
{code}

and the resulting {{outputFile}} is a concatenation of two absolute paths.

Here's the patch:
{noformat}
diff --git a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
index 981185f..f75c63b 100644
--- a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
+++ b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
@@ -372,7 +372,6 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
             Resource r2 = scanForResources(genroot, testRoot);
             if (r2 != testRoot) {
                 r2.setDirectory(getGeneratedTestRoot().getAbsolutePath());
-                r2.setTargetPath(project.getBuild().getTestOutputDirectory());
                 project.addTestResource(r2);
             }
         }
{noformat}

adding resource as testResource already declares it to be outputted in TestOutputDirectory.

regards
Grzegorz Grzybek
                
      was (Author: gzres):
    The problem is in {{org.apache.cxf.maven_plugin.AbstractCodegenMoho.checkResources()}}
method, in this fragment:
{code:java}
  genroot = getGeneratedTestRoot();
  if (genroot != null) {
      List<Resource> resources = project.getBuild().getTestResources();
      for (Resource r : resources) {
          File d = new File(root, r.getDirectory());
          if (d.equals(genroot)) {
              testRoot = r;
          } 
      }
      Resource r2 = scanForResources(genroot, testRoot);
      if (r2 != testRoot) {
          r2.setDirectory(getGeneratedTestRoot().getAbsolutePath());
          r2.setTargetPath(project.getBuild().getTestOutputDirectory());
          project.addTestResource(r2);
      }
  }
{code}

{{r2.setTargetPath(project.getBuild().getTestOutputDirectory());}} is wrong, because JavaDoc
for {{org.apache.maven.model.Resource.setTargetPath(String)}} says:
{noformat}
... The path is relative to the target/classes directory ...
{noformat}
(for test resources, the path is related to "target/test-classes" directory).

Setting the target path to {{project.getBuild().getTestOutputDirectory()}} (in my case: "C:\Dev\Git\projects-github-grgrzybek\cxf\systests\databinding\target\test-classes")
leads (much) later to the following (in maven-eclipse-plugin):
{code:java}
if ( !StringUtils.isEmpty( resource.getTargetPath() ) )
{
   outputFile = new File( "C:\Dev\Git\projects-github-grgrzybek\cxf\systests\databinding\target\test-classes",
"C:\Dev\Git\projects-github-grgrzybek\cxf\systests\databinding\target\test-classes" )
   ...
{code}

and the resulting outputFile is a concatenation of two absoulute paths.

Here's the patch:
{noformat}
diff --git a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
index 981185f..f75c63b 100644
--- a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
+++ b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
@@ -372,7 +372,6 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
             Resource r2 = scanForResources(genroot, testRoot);
             if (r2 != testRoot) {
                 r2.setDirectory(getGeneratedTestRoot().getAbsolutePath());
-                r2.setTargetPath(project.getBuild().getTestOutputDirectory());
                 project.addTestResource(r2);
             }
         }
{noformat}

adding resource as testResource already declares it to be outputted in TestOutputDirectory.

regards
Grzegorz Grzybek
                  
> -Psetup.eclipse fails on Windows
> --------------------------------
>
>                 Key: CXF-5215
>                 URL: https://issues.apache.org/jira/browse/CXF-5215
>             Project: CXF
>          Issue Type: Bug
>          Components: Build system
>    Affects Versions: 2.7.7
>            Reporter: Thorsten Hoeger
>         Attachments: maven_log.txt
>
>
> Building the repository with -Psetup.eclipse failes in systest-databinding

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message