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

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


Then your MANIFEST would look like:

source.. = src/
output.. = bin/
bin.includes = META-INF/,\
               .,\
               resources/


And you do not have to specify anything regarding resources in your pom and will be able to use pomless build for that plugin.

If you need to do maven resource filtering, you need the pom enabling filtering:

		<resources>
			<resource>
				<directory>resources</directory>
				<targetPath>resources</targetPath>
				<filtering>true</filtering>
				<includes>
					<include>**/*</include>
				</includes>
			</resource>
		</resources>

-martin





-----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


Back to the top