Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to bundle datasets with maven projects #33

Open
Aklakan opened this issue Dec 9, 2023 · 0 comments
Open

Document how to bundle datasets with maven projects #33

Aklakan opened this issue Dec 9, 2023 · 0 comments

Comments

@Aklakan
Copy link
Member

Aklakan commented Dec 9, 2023

Usually, java dependencies are jar files. However, on the publisher side, we don't want to enforce having to bundle all data as jars and rather make it possible to download e.g. .csv files or .ttl.bz2 files directly.

Usually, one can place resources such as datasets into src/main/resources and upon deployment they become part of the jar bundle.

With non-jar resources, we can't use traditional <dependency> blocks to bundle them with an application.
However, a project can declare an additional resource folder under the target folder and then use the maven-dependency-plugin to copy non-jar resources there. Instead of <dependency> blocks, references are expressed using <artifactItem> - but the rest is the same. The additional overhead seems acceptable; essentially its a copy&paste of the snippet below.

<build>
	<resources>
		<resource>
			<directory>src/main/resources</directory>
		</resource>
		<resource>
			<directory>${project.build.directory}/datasets</directory>
		</resource>
	</resources>

	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-dependency-plugin</artifactId>
			<version>3.6.1</version>
			<executions>
				<execution>
					<id>resource-dependencies</id>
					<phase>process-resources</phase>
					<goals>
						<goal>copy</goal>
					</goals>
					<configuration>
						<stripVersion>true</stripVersion>
						<artifactItems>
							<artifactItem>
								<groupId>org.aksw.moin</groupId>
								<artifactId>moin</artifactId>
								<version>2022-05-02.1-SNAPSHOT</version>
								<type>ttl.bz2</type>
								<overWrite>true</overWrite>
								<outputDirectory>${project.build.directory}/datasets</outputDirectory>
							</artifactItem>
						</artifactItems>
						<!--<includes>directory_to_include/**</includes>
						<outputDirectory>${project.build.outputDirectory}</outputDirectory>
						-->
					</configuration>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>

In the IDE it then looks like this:
image

@Aklakan Aklakan changed the title Document how to reference datasets with maven Document how to bundle datasets with maven projects Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant