This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Maven scala compile failing if resource defined

5 replies
corcorda
Joined: 2009-10-14,
User offline. Last seen 42 years 45 weeks ago.

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

Joshua.Suereth
Joined: 2008-09-02,
User offline. Last seen 32 weeks 5 days ago.
Re: Maven scala compile failing if resource defined
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 <dave.corcoran@gmail.com> 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 <resources> 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-tp25891617p25891617.html
Sent from the Scala - Tools mailing list archive at Nabble.com.


david.bernard
Joined: 2009-01-08,
User offline. Last seen 1 year 27 weeks ago.
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.
>>
>
>

corcorda
Joined: 2009-10-14,
User offline. Last seen 42 years 45 weeks ago.
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?
>
>

corcorda
Joined: 2009-10-14,
User offline. Last seen 42 years 45 weeks ago.
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
>
>
>

corcorda
Joined: 2009-10-14,
User offline. Last seen 42 years 45 weeks ago.
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
>

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland