Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Maven Integration (M2E) » How to write to /src/main/resources?
How to write to /src/main/resources? [message #25796] Fri, 08 May 2009 20:08 Go to next message
Eclipse User
Originally posted by: asd.asd.com

I have installed maven in eclipse on Vista 32.

I have made a tmp folder in /src/main/resources:

/src/main/resources/tmp

Now I want to write some files to this folder, but how do I get the full
path?
Re: How to write to /src/main/resources? [message #25844 is a reply to message #25796] Sat, 09 May 2009 04:10 Go to previous messageGo to next message
Eclipse User
Originally posted by: igor.ifedorenko.com

Can you explain what you are trying to achieve?

--
Regards,
Igor


JS wrote:
> I have installed maven in eclipse on Vista 32.
>
> I have made a tmp folder in /src/main/resources:
>
> /src/main/resources/tmp
>
> Now I want to write some files to this folder, but how do I get the full
> path?
Re: How to write to /src/main/resources? [message #25885 is a reply to message #25844] Sat, 09 May 2009 10:02 Go to previous messageGo to next message
Eclipse User
Originally posted by: asd.asd.com

I have an application in a maven module A that needs to write a file to a
tmp folder during runtime. But the application is called from another module
B which means that:

System.getProperty("user.dir")

refers to module B's location. I have created the tmp folder in:

/src/main/resources/tmp

under module A (it should not be placed in module B's resources). But how do
I get that path?



does not
"Igor Fedorenko" <igor@ifedorenko.com> wrote in message
news:gu2vo0$uhk$1@build.eclipse.org...
> Can you explain what you are trying to achieve?
>
> --
> Regards,
> Igor
>
>
> JS wrote:
>> I have installed maven in eclipse on Vista 32.
>>
>> I have made a tmp folder in /src/main/resources:
>>
>> /src/main/resources/tmp
>>
>> Now I want to write some files to this folder, but how do I get the full
>> path?
Re: How to write to /src/main/resources? [message #26175 is a reply to message #25885] Mon, 11 May 2009 17:18 Go to previous messageGo to next message
Eclipse User
Originally posted by: igor.ifedorenko.com

I am not 100% sure, but it looks like you are mixing build and runtime
environments. Normally, maven project layout (i.e. src/main/resources
and the rest), are not present at runtime and location of temporary
files really depends on your application logic.

--
Regards,
Igor

JS wrote:
> I have an application in a maven module A that needs to write a file to
> a tmp folder during runtime. But the application is called from another
> module B which means that:
>
> System.getProperty("user.dir")
>
> refers to module B's location. I have created the tmp folder in:
>
> /src/main/resources/tmp
>
> under module A (it should not be placed in module B's resources). But
> how do I get that path?
>
>
>
> does not
> "Igor Fedorenko" <igor@ifedorenko.com> wrote in message
> news:gu2vo0$uhk$1@build.eclipse.org...
>> Can you explain what you are trying to achieve?
>>
>> --
>> Regards,
>> Igor
>>
>>
>> JS wrote:
>>> I have installed maven in eclipse on Vista 32.
>>>
>>> I have made a tmp folder in /src/main/resources:
>>>
>>> /src/main/resources/tmp
>>>
>>> Now I want to write some files to this folder, but how do I get the
>>> full path?
>
Re: How to write to /src/main/resources? [message #26216 is a reply to message #25885] Mon, 11 May 2009 17:23 Go to previous message
Will Horn is currently offline Will Horn
Messages: 265
Registered: July 2009
Senior Member
First, files in "src/main/resources" will be added to your application jar
so you can always read them (in Java) from Class#getResourceAsStream. But
you can't write to there!

And your application shouldn't rely on source code folders. "user.dir"
happens to be the location where application B is launched, but what about
when you build the jar and ship it to someone else? How about using
System.getProperty("java.io.tmpdir")?

-Will

"JS" <asd@asd.com> wrote in message news:gu3kas$7q5$1@build.eclipse.org...
>I have an application in a maven module A that needs to write a file to a
>tmp folder during runtime. But the application is called from another
>module B which means that:
>
> System.getProperty("user.dir")
>
> refers to module B's location. I have created the tmp folder in:
>
> /src/main/resources/tmp
>
> under module A (it should not be placed in module B's resources). But how
> do I get that path?
>
>
>
> does not
> "Igor Fedorenko" <igor@ifedorenko.com> wrote in message
> news:gu2vo0$uhk$1@build.eclipse.org...
>> Can you explain what you are trying to achieve?
>>
>> --
>> Regards,
>> Igor
>>
>>
>> JS wrote:
>>> I have installed maven in eclipse on Vista 32.
>>>
>>> I have made a tmp folder in /src/main/resources:
>>>
>>> /src/main/resources/tmp
>>>
>>> Now I want to write some files to this folder, but how do I get the full
>>> path?
>
Previous Topic:m2e Resolve Workspace artifacts problem
Next Topic:Eclipse RCP application with Tycho
Goto Forum:
  


Current Time: Fri Oct 24 23:12:20 GMT 2014

Powered by FUDForum. Page generated in 0.13002 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software