Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] No packaging of resources into jar

there is no need for <resources> in pom.xml

you can add in build.properties

source.. = src/main/java,src/main/resources

this will make both PDE and Tycho add src/main/resources as source dir, which will simply copy any non-java resources over to the classes folder during compile (even if there are no actual java sources in src/main/resources). No need to manually adjust .classpath in this case.

Regards
Jan






On 25/04/16 19:54, "tycho-user-bounces@xxxxxxxxxxx on behalf of SCHREIBER.Martin" <tycho-user-bounces@xxxxxxxxxxx on behalf of Martin.SCHREIBER@xxxxxxxxxxxxx> wrote:

>Hi Ralf,
>
>the main feature of Tycho is to support building OSGi bundles like Eclipse Plugins with maven. The default directory structure of Eclipse Plugins is different then the dir structure of pure maven projects. If you realy want to use the default maven structure for Eclipse Plugins this might work:
>
>foo.bar/src/main/java/.... all java files
>foo.bar/src/main/resources/ all resource files
>foo.bar/src/META-INF/MANIFEST.MF
>foo.bar/build.properties
>foo.bar/pom.xml
>
>Content of build.properties:
>----------------------------------
>    source.. = src/main/java
>    output.. = bin/
>    bin.includes = META-INF/,\
>               .
>----------------------------------
>Note that bin.includes does not include the src/main/resources but the "." directory is.
>And within the pom.xml to pull in the resource files:
>-----------------------------------
>		<resources>
>			<resource>
>				<directory>src/main/resources</directory>
>				<targetPath>resources</targetPath>
>				<includes>
>					<include>**/*</include>
>				</includes>
>			</resource>
>		</resources>
>---------------------------------------
>(And within Eclipse the classpath has to be adjusted that the src directory is under "src/main/java" to make JDT happy). 
>
>With that setup you could not use pomless builds anymore because of the <resources> stuff in the pom. Well maybe it does if it works if you could specify that in the parent pom.
>
>hth
>martin
>
>
>
>
>________________________________________
>Von: tycho-user-bounces@xxxxxxxxxxx <tycho-user-bounces@xxxxxxxxxxx> im Auftrag von Ralf Heydenreich <rheydenr@xxxxxxxxxxx>
>Gesendet: Montag, 25. April 2016 19:15
>An: tycho-user@xxxxxxxxxxx
>Betreff: Re: [tycho-user] No packaging of resources into jar
>
>Am 25.04.2016 um 08:59 schrieb SCHREIBER.Martin:
>> Hi Ralf,
>>
>> I recommend not to place the resources under the "src" directory.
>> The setup is much easier if you place all the resources into a "resources" folder within your project and not the src directory:
>>
>> Foo.bar/
>>                 pom.xml
>>                 src/foo/bar/MyPlugin.java
>>                 resources/mypic.png
>>                 resources/mytextfile.txt
>>
>>
>> [...]
>
>Hi Martin,
>thanks for your fast answer. I'm afraid of this... I've tried to keep on
>default structure for Maven projects, as described here:
>https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
>
>Ok, I've changed it and now it works pomless again. But, anyhow, is
>there a possibility to keep on default structure? To copy the resources
>into jar root?
>
>Regards,
>Ralf.
>
>
>>
>>
>>
>>
>> -----Urspr√ľngliche Nachricht-----
>> Von: tycho-user-bounces@xxxxxxxxxxx [mailto:tycho-user-bounces@xxxxxxxxxxx] Im Auftrag von Ralf Heydenreich
>> Gesendet: Montag, 25. April 2016 01:06
>> An: tycho-user@xxxxxxxxxxx
>> Betreff: [tycho-user] No packaging of resources into jar
>>
>> Hi all,
>> I've a project which contains some resources under /src/main/resources.
>> Now I want to pack these resources into my jar file. But it doesn't work. The resources are copied to /classes/resources, but the resulting jar file is empty!
>>
>> I have the following configuration:
>>
>> build.properties:
>> bin.includes = META-INF/,\
>>                src/main/resources/
>>
>> pom.xml:
>> <?xml version="1.0" encoding="UTF-8"?>
>> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>> http://maven.apache.org/xsd/maven-4.0.0.xsd";
>> xmlns="http://maven.apache.org/POM/4.0.0";
>>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
>>   <modelVersion>4.0.0</modelVersion>
>>   <parent>
>>     <groupId>com.mycompany.myapp</groupId>
>>     <artifactId>MyApp-Parent</artifactId>
>>     <version>2.0.0-SNAPSHOT</version>
>>   </parent>
>>   <artifactId>com.mycompany.myapp.resources.templates</artifactId>
>>   <version>2.0.0-SNAPSHOT</version>
>>   <packaging>eclipse-plugin</packaging>
>>       <build>
>>         <resources>
>>             <resource>
>>                 <directory>src/main/resources</directory>
>>                 <targetPath>resources</targetPath>
>>                 <!-- filtering>true</filtering -->
>>                 <includes>
>>                     <include>**/*</include>
>>                 </includes>
>>             </resource>
>>         </resources>
>> </build>
>> </project>
>>
>> I've tried it with a pom-less  build, but this didn't work, too. How can I pack the resource files into the jar file?
>>
>> TIA,
>> Ralf
>>
>
>_______________________________________________
>tycho-user mailing list
>tycho-user@xxxxxxxxxxx
>To change your delivery options, retrieve your password, or unsubscribe from this list, visit
>https://dev.eclipse.org/mailman/listinfo/tycho-user
>_______________________________________________
>tycho-user mailing list
>tycho-user@xxxxxxxxxxx
>To change your delivery options, retrieve your password, or unsubscribe from this list, visit
>https://dev.eclipse.org/mailman/listinfo/tycho-user

Back to the top