You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Andrew J. Leer (JIRA)" <ji...@codehaus.org> on 2007/09/07 17:08:11 UTC

[jira] Created: (MNG-3198) ${basedir} variable makes portable builds overly difficult

${basedir} variable makes portable builds overly difficult
----------------------------------------------------------

                 Key: MNG-3198
                 URL: http://jira.codehaus.org/browse/MNG-3198
             Project: Maven 2
          Issue Type: Bug
          Components: Design, Patterns & Best Practices, Logging, POM, POM::Encoding, Profiles
    Affects Versions: 2.0.7
            Reporter: Andrew J. Leer
         Attachments: SimpleTest21.tar, SimpleTest21.zip

Using log4j.xml I tried to use the resource filtering mechanism of Maven2 to write log files to the directory:

${basedir}/logs
(in windows)

In the end the log files indeed do end up in the project directory, but not the ./log directory.

Also the name of the log file becomes the path with all of the '\' (${file.seprator}'s taken out of it:

For instance if the path to my log file was:

     "C:\dev\workspace\project\logs\project-1.0-dev_test.log"

My log file would appear in ${basedir} and be called:

    "devworkspaceprojectlogsproject-1.0-dev_test.log"

Thank you, 
     Andrew J. Leer

-- 
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: (MNG-3198) ${basedir} variable makes portable builds overly difficult

Posted by "Gili (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-3198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=225513#action_225513 ] 

Gili commented on MNG-3198:
---------------------------

Please reopen this issue!

> ${basedir} variable makes portable builds overly difficult
> ----------------------------------------------------------
>
>                 Key: MNG-3198
>                 URL: http://jira.codehaus.org/browse/MNG-3198
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Design, Patterns & Best Practices, Logging, POM, POM::Encoding, Profiles
>    Affects Versions: 2.0.7
>            Reporter: Andrew J. Leer
>            Assignee: Brett Porter
>         Attachments: SimpleTest21.tar, SimpleTest21.zip
>
>
> Using log4j.xml I tried to use the resource filtering mechanism of Maven2 to write log files to the directory:
> ${basedir}/logs
> (in windows)
> In the end the log files indeed do end up in the project directory, but not the ./log directory.
> Also the name of the log file becomes the path with all of the '\' (${file.seprator}'s taken out of it:
> For instance if the path to my log file was:
>      "C:\dev\workspace\project\logs\project-1.0-dev_test.log"
> My log file would appear in ${basedir} and be called:
>     "devworkspaceprojectlogsproject-1.0-dev_test.log"
> Thank you, 
>      Andrew J. Leer

-- 
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: (MNG-3198) ${basedir} variable makes portable builds overly difficult

Posted by "Jochen Wiedmann (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-3198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_106950 ] 

Jochen Wiedmann commented on MNG-3198:
--------------------------------------

Note, that you can safely use C:/dev/workspace/... even on Windows. In other words, the requirement to distinguish between / and \\ will most likely only  be present when running an external batch script or something like that. However, if you do that, then you are platform dependent anyways and should use platform specific profiles, in which case file.separator would simply make the POM unreadable.


> ${basedir} variable makes portable builds overly difficult
> ----------------------------------------------------------
>
>                 Key: MNG-3198
>                 URL: http://jira.codehaus.org/browse/MNG-3198
>             Project: Maven 2
>          Issue Type: Bug
>          Components: Design, Patterns & Best Practices, Logging, POM, POM::Encoding, Profiles
>    Affects Versions: 2.0.7
>            Reporter: Andrew J. Leer
>         Attachments: SimpleTest21.tar, SimpleTest21.zip
>
>
> Using log4j.xml I tried to use the resource filtering mechanism of Maven2 to write log files to the directory:
> ${basedir}/logs
> (in windows)
> In the end the log files indeed do end up in the project directory, but not the ./log directory.
> Also the name of the log file becomes the path with all of the '\' (${file.seprator}'s taken out of it:
> For instance if the path to my log file was:
>      "C:\dev\workspace\project\logs\project-1.0-dev_test.log"
> My log file would appear in ${basedir} and be called:
>     "devworkspaceprojectlogsproject-1.0-dev_test.log"
> Thank you, 
>      Andrew J. Leer

-- 
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: (MNG-3198) ${basedir} variable makes portable builds overly difficult

Posted by "Paul Benedict (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-3198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=201874#action_201874 ] 

Paul Benedict commented on MNG-3198:
------------------------------------

I configure my log4j and send its files to {{${project.build.directory}/logs}}. My rule of thumb is anything and everything transitory should end up in the build directory.

> ${basedir} variable makes portable builds overly difficult
> ----------------------------------------------------------
>
>                 Key: MNG-3198
>                 URL: http://jira.codehaus.org/browse/MNG-3198
>             Project: Maven 2
>          Issue Type: Bug
>          Components: Design, Patterns & Best Practices, Logging, POM, POM::Encoding, Profiles
>    Affects Versions: 2.0.7
>            Reporter: Andrew J. Leer
>            Assignee: Brett Porter
>         Attachments: SimpleTest21.tar, SimpleTest21.zip
>
>
> Using log4j.xml I tried to use the resource filtering mechanism of Maven2 to write log files to the directory:
> ${basedir}/logs
> (in windows)
> In the end the log files indeed do end up in the project directory, but not the ./log directory.
> Also the name of the log file becomes the path with all of the '\' (${file.seprator}'s taken out of it:
> For instance if the path to my log file was:
>      "C:\dev\workspace\project\logs\project-1.0-dev_test.log"
> My log file would appear in ${basedir} and be called:
>     "devworkspaceprojectlogsproject-1.0-dev_test.log"
> Thank you, 
>      Andrew J. Leer

-- 
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: (MNG-3198) ${basedir} variable makes portable builds overly difficult

Posted by "Emmanuel Hugonnet (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-3198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_106933 ] 

Emmanuel Hugonnet commented on MNG-3198:
----------------------------------------

Hi,
Log4j loads its arguments as java.util.Properties (even if they are in a XML file). '\' is used as an escape parameters in Properties so you have to use '\\' instead. What you propose would only postpone the problem because if you want to write to another directory ${basedir}/../logs for example it would fail the same way :o(.
Handling path with properties is quite annoying when you want to be cross-platform
Emmanuel

> ${basedir} variable makes portable builds overly difficult
> ----------------------------------------------------------
>
>                 Key: MNG-3198
>                 URL: http://jira.codehaus.org/browse/MNG-3198
>             Project: Maven 2
>          Issue Type: Bug
>          Components: Design, Patterns & Best Practices, Logging, POM, POM::Encoding, Profiles
>    Affects Versions: 2.0.7
>            Reporter: Andrew J. Leer
>         Attachments: SimpleTest21.tar, SimpleTest21.zip
>
>
> Using log4j.xml I tried to use the resource filtering mechanism of Maven2 to write log files to the directory:
> ${basedir}/logs
> (in windows)
> In the end the log files indeed do end up in the project directory, but not the ./log directory.
> Also the name of the log file becomes the path with all of the '\' (${file.seprator}'s taken out of it:
> For instance if the path to my log file was:
>      "C:\dev\workspace\project\logs\project-1.0-dev_test.log"
> My log file would appear in ${basedir} and be called:
>     "devworkspaceprojectlogsproject-1.0-dev_test.log"
> Thank you, 
>      Andrew J. Leer

-- 
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: (MNG-3198) ${basedir} variable makes portable builds overly difficult

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-3198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=226197#action_226197 ] 

Brett Porter commented on MNG-3198:
-----------------------------------

please open an issue in the resources plugin if you need a feature to get the basedir using unix-style separators. I don't believe this is needed in the core. I assume this is only for test cases and plugins run through the build - note that you can also rely on the basedir being the work directory, so you can use relative paths.

> ${basedir} variable makes portable builds overly difficult
> ----------------------------------------------------------
>
>                 Key: MNG-3198
>                 URL: http://jira.codehaus.org/browse/MNG-3198
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Design, Patterns & Best Practices, Logging, POM, POM::Encoding, Profiles
>    Affects Versions: 2.0.7
>            Reporter: Andrew J. Leer
>            Assignee: Brett Porter
>         Attachments: SimpleTest21.tar, SimpleTest21.zip
>
>
> Using log4j.xml I tried to use the resource filtering mechanism of Maven2 to write log files to the directory:
> ${basedir}/logs
> (in windows)
> In the end the log files indeed do end up in the project directory, but not the ./log directory.
> Also the name of the log file becomes the path with all of the '\' (${file.seprator}'s taken out of it:
> For instance if the path to my log file was:
>      "C:\dev\workspace\project\logs\project-1.0-dev_test.log"
> My log file would appear in ${basedir} and be called:
>     "devworkspaceprojectlogsproject-1.0-dev_test.log"
> Thank you, 
>      Andrew J. Leer

-- 
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: (MNG-3198) ${basedir} variable makes portable builds overly difficult

Posted by "Mark Michaelis (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-3198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=201866#action_201866 ] 

Mark Michaelis commented on MNG-3198:
-------------------------------------

Actually this is a real problem. Especially when working together with the config-processor-plugin.

I have a property which is defined as:
{code}
${basedir}/somepath
{code}

Now the config-processor-plugin will write a property file containing:

{code}
somepath=C:\dev/somepath
{code}

And Java will fail to read this property file as it reads:

{code}
C:dev/somepath
{code}

So this would be no problem if basedir uses slashes as file separators.

> ${basedir} variable makes portable builds overly difficult
> ----------------------------------------------------------
>
>                 Key: MNG-3198
>                 URL: http://jira.codehaus.org/browse/MNG-3198
>             Project: Maven 2
>          Issue Type: Bug
>          Components: Design, Patterns & Best Practices, Logging, POM, POM::Encoding, Profiles
>    Affects Versions: 2.0.7
>            Reporter: Andrew J. Leer
>            Assignee: Brett Porter
>         Attachments: SimpleTest21.tar, SimpleTest21.zip
>
>
> Using log4j.xml I tried to use the resource filtering mechanism of Maven2 to write log files to the directory:
> ${basedir}/logs
> (in windows)
> In the end the log files indeed do end up in the project directory, but not the ./log directory.
> Also the name of the log file becomes the path with all of the '\' (${file.seprator}'s taken out of it:
> For instance if the path to my log file was:
>      "C:\dev\workspace\project\logs\project-1.0-dev_test.log"
> My log file would appear in ${basedir} and be called:
>     "devworkspaceprojectlogsproject-1.0-dev_test.log"
> Thank you, 
>      Andrew J. Leer

-- 
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: (MNG-3198) ${basedir} variable makes portable builds overly difficult

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-3198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brett Porter closed MNG-3198.
-----------------------------

      Assignee: Brett Porter
    Resolution: Won't Fix

it sounds like a reasonable alternative was provided, please reopen if that's not the case.

> ${basedir} variable makes portable builds overly difficult
> ----------------------------------------------------------
>
>                 Key: MNG-3198
>                 URL: http://jira.codehaus.org/browse/MNG-3198
>             Project: Maven 2
>          Issue Type: Bug
>          Components: Design, Patterns & Best Practices, Logging, POM, POM::Encoding, Profiles
>    Affects Versions: 2.0.7
>            Reporter: Andrew J. Leer
>            Assignee: Brett Porter
>         Attachments: SimpleTest21.tar, SimpleTest21.zip
>
>
> Using log4j.xml I tried to use the resource filtering mechanism of Maven2 to write log files to the directory:
> ${basedir}/logs
> (in windows)
> In the end the log files indeed do end up in the project directory, but not the ./log directory.
> Also the name of the log file becomes the path with all of the '\' (${file.seprator}'s taken out of it:
> For instance if the path to my log file was:
>      "C:\dev\workspace\project\logs\project-1.0-dev_test.log"
> My log file would appear in ${basedir} and be called:
>     "devworkspaceprojectlogsproject-1.0-dev_test.log"
> Thank you, 
>      Andrew J. Leer

-- 
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