- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Maven scala compile failing if resource defined
Wed, 2009-10-14, 14:59
Hi,
I'm using the maven-scala-plugin for a scala only project and it was working
great. I've added maven to the project late so unfortunately it doesn't
follow the standard directory structure. The structure is like so:
src/package...
src/generatedSourceFiles/package...
src/resources/log4.properties (only 1 resource so far)
If I add the tag to the pom and do a clean compile the resource
is copied but the compile finishes saying "nothing to compile...". If I
delete the resource (from the resource/ dir) and do another clean compile
the code is compiled fine (but obviously no resource is copied).
I've attached my pom.xml. Is there something I'm doing wrong?
Any help would be great.
Thanks,
Dave
Wed, 2009-10-14, 20:17
#2
Re: Maven scala compile failing if resource defined
you should not put root of resources under a sub folder or your code
(to compile) source.
minimal changes to try :
move src/resources/log4.properties to resources/log4.properties
add tag to the pom.xml
/davidB
On Wed, Oct 14, 2009 at 19:54, Josh Suereth wrote:
> Resources are considered static things that get appended to the classpath,
> and are not compiled. They should be copied into the resulting jars that
> are generated.
>
> What behavior are you expecting?
>
> On Wed, Oct 14, 2009 at 9:59 AM, corcorda wrote:
>>
>> Hi,
>>
>> I'm using the maven-scala-plugin for a scala only project and it was
>> working
>> great. I've added maven to the project late so unfortunately it doesn't
>> follow the standard directory structure. The structure is like so:
>> src/package...
>> src/generatedSourceFiles/package...
>> src/resources/log4.properties (only 1 resource so far)
>>
>> If I add the tag to the pom and do a clean compile the
>> resource
>> is copied but the compile finishes saying "nothing to compile...". If I
>> delete the resource (from the resource/ dir) and do another clean compile
>> the code is compiled fine (but obviously no resource is copied).
>>
>> I've attached my pom.xml. Is there something I'm doing wrong?
>>
>> Any help would be great.
>>
>> Thanks,
>>
>> Dave
>>
>> http://www.nabble.com/file/p25891617/pom.xml pom.xml
>> --
>> View this message in context:
>> http://www.nabble.com/Maven-scala-compile-failing-if-resource-defined-tp...
>> Sent from the Scala - Tools mailing list archive at Nabble.com.
>>
>
>
Thu, 2009-10-15, 09:07
#3
Re: Maven scala compile failing if resource defined
Hi Josh,
I think you may have misread my mail, or maybe it wasn't clear enough. I
know resources should just be copied into somewhere on the classpath. The
problem is that when I put a resource in my resource directory it gets
copied, but none of the .scala files get compiled. So my out/ directory just
has the resource and no class files. If I delete the resource file from the
resources dir and do a clean compile the out/ directory is filled with
classes as expected. I was wondering why having a resource folder was
stopping the build.
Regards,
Dave
Josh Suereth wrote:
>
> Resources are considered static things that get appended to the classpath,
> and are not compiled. They should be copied into the resulting jars that
> are generated.
>
> What behavior are you expecting?
>
>
Thu, 2009-10-15, 09:17
#4
Re: Maven scala compile failing if resource defined
Hi David,
I tried it in several places, including putting it above the src folder as
you suggested. It has the same effect. I only put it under src orginally
because the maven spec suggests using src/main/resources
Thanks,
Dave
David Bernard-3 wrote:
>
> you should not put root of resources under a sub folder or your code
> (to compile) source.
> minimal changes to try :
> move src/resources/log4.properties to resources/log4.properties
> add tag to the pom.xml
>
> /davidB
>
>
>
Tue, 2009-10-20, 15:27
#5
Re: Maven scala compile failing if resource defined
For anyone else that runs into this problem, the solution was to remove
out
from the pom.xml. Everything now compiles fine *and* the resources are
copied.
corcorda wrote:
>
> Hi,
>
> I'm using the maven-scala-plugin for a scala only project and it was
> working great. I've added maven to the project late so unfortunately it
> doesn't follow the standard directory structure. The structure is like so:
> src/package...
> src/generatedSourceFiles/package...
> src/resources/log4.properties (only 1 resource so far)
>
> If I add the tag to the pom and do a clean compile the
> resource is copied but the compile finishes saying "nothing to
> compile...". If I delete the resource (from the resource/ dir) and do
> another clean compile the code is compiled fine (but obviously no resource
> is copied).
>
> I've attached my pom.xml. Is there something I'm doing wrong?
>
> Any help would be great.
>
> Thanks,
>
> Dave
>
> http://www.nabble.com/file/p25891617/pom.xml pom.xml
>
What behavior are you expecting?
On Wed, Oct 14, 2009 at 9:59 AM, corcorda <dave.corcoran@gmail.com> wrote: