Re: Maven not copying java resources into jar file
Re: Maven not copying java resources into jar file
- Subject: Re: Maven not copying java resources into jar file
- From: Hugi Thordarson <email@hidden>
- Date: Tue, 22 Mar 2016 16:37:21 +0000
This worked perfectly, thanks Henrique!
I wonder if WebObjects resources should perhaps live in a different folder than src/main/resources? That folder is a standard part of the maven project structure and this made for some really unexpeted behaviour.
Cheers,
- hugi
> On 22. mar. 2016, at 16:29, Henrique Prange <email@hidden> wrote:
>
> Hi Hugi,
>
> AFAIR, the wolifecycle-maven-plugin copies all files from src/main/resources into the Resources folder. However, you can use the maven-resources-plugin to copy the required files into the Maven output directory.
>
> <build>
> <plugins>
> <plugin>
> <artifactId>maven-resources-plugin</artifactId>
> <version>2.6</version>
> <executions>
> <execution>
> <id>copy-resources</id>
> <phase>validate</phase>
> <goals>
> <goal>copy-resources</goal>
> </goals>
> <configuration>
> <outputDirectory>${project.build.outputDirectory}</outputDirectory>
> <resources>
> <resource>
> <directory>src/main/resources</directory>
> </resource>
> </resources>
> </configuration>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
>
> See the maven-resources-plugin [1] documentation for more information.
>
> [1]https://maven.apache.org/plugins/maven-resources-plugin/
>
> Cheers,
>
> Henrique
>
>> On 22 de mar de 2016, at 06:39, Hugi Thordarson <email@hidden> wrote:
>>
>> Hi Lachlan,
>> Here’s what my pom looks like, pretty vanilla:
>>
>> https://gist.github.com/anonymous/00e2cee94b185cd846af
>>
>> I’m just running mvn package for the build, should I be running different goals?
>>
>> Thanks for all your help :)
>>
>> - hugi
>>
>>
>>
>>> On 21. mar. 2016, at 22:36, Lachlan Deck <email@hidden> wrote:
>>>
>>> A couple of questions:
>>> - What’s your pom look like?
>>> - What commands are you running?
>>>
>>> The relevant section is the woman-lifecycle-plugin.
>>>
>>> Your src/main/resources is a standard path for maven; that’s not your problem.
>>>
>>> mvn clean package should create your jar in target/.
>>>
>>> cheers,
>>> Lachlan
>>>
>>>
>>>> On 22 Mar 2016, at 8:55 AM, Hugi Thordarson <email@hidden> wrote:
>>>>
>>>> Hi Lachlan,
>>>> Thanks, I found the pom you mentioned, but I don’t quite see which parts of it are relevant to my question?
>>>>
>>>> - hugi
>>>>
>>>>
>>>>
>>>>> On 21. mar. 2016, at 20:55, Lachlan Deck <email@hidden> wrote:
>>>>>
>>>>> Perhaps @see the list archives for the pom I’d sent to the list in 2012.
>>>>>
>>>>> ——
>>>>> Subject: Re: Maven
>>>>> From: Lachlan Deck <email@hidden>
>>>>> In-Reply-To: <email@hidden>
>>>>> Date: Sat, 21 Jan 2012 11:01:25 +1100
>>>>> Message-Id: <email@hidden>
>>>>> References: <email@hidden>
>>>>> ——
>>>>>
>>>>> Maven uses the relevant plugin for your <packaging /> to determine where things live. So if you’re using `woapplication` or `woframework` (I think the options are) as your packaging type, then you’ll need the relevant plugin in your build section which I think from memory is the womaven-lifecycle-plugin.
>>>>>
>>>>> This has been the case for some years, though I’m not familiar with the current state of things. Have you tried a basic hello world app following the wiki guides for maven?
>>>>>
>>>>> cheers,
>>>>> Lachlan
>>>>>
>>>>>
>>>>>> On 22 Mar 2016, at 4:01 AM, Hugi Thordarson <email@hidden> wrote:
>>>>>>
>>>>>> OK, turns out it was Eclipse that was copying the resources to the classes-folder… I should have known.
>>>>>>
>>>>>> But the question then still remains; how do I introduce the standard maven resources behaviour to my WO projects, i.e. make tem copy resources from src/main/resources into my jar file.
>>>>>>
>>>>>> Cheers,
>>>>>> - hugi
>>>>>>
>>>>>>
>>>>>>
>>>>>>> On 21. mar. 2016, at 16:26, Hugi Thordarson <email@hidden> wrote:
>>>>>>>
>>>>>>> Hi all.
>>>>>>>
>>>>>>> I’ve begun the fun task of converting all my WO apps to maven (finally) but I’m encountering odd behaviour with resources.
>>>>>>>
>>>>>>> In my src/main/resources I have a couple of xml files that should end up in the final jar (as they do with a regular java maven build). If I run “mvn pakage” on my dev machine, these xml-files are copied to the jar file as I would expect. But when I run the very same build on my jenkins server, the files just get copied to MyApp.woa/Contents/Resources, but not into the jar file.
>>>>>>>
>>>>>>> Any ideas?
>>>>>>>
>>>>>>> Cheers,
>>>>>>> - hugi
>>>>>>>
>>>>>>> // Hugi Thordarson
>>>>>>> // http://www.loftfar.is/
>>>>>>> // s. 895-6688
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>>> Webobjects-dev mailing list (email@hidden)
>>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>>
>>>>>>> This email sent to email@hidden
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>> Webobjects-dev mailing list (email@hidden)
>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>
>>>>>> This email sent to email@hidden
>>>>>
>>>>
>>>
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden