You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Mariusz Dubielecki (JIRA)" <ji...@apache.org> on 2015/02/20 10:36:13 UTC

[jira] [Comment Edited] (KARAF-2742) karaf-maven-plugin can not include filtered resources in a custom distribution

    [ https://issues.apache.org/jira/browse/KARAF-2742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14328724#comment-14328724 ] 

Mariusz Dubielecki edited comment on KARAF-2742 at 2/20/15 9:35 AM:
--------------------------------------------------------------------

Hi, I've had the same problem, but you can hack it a wee bit like that:
{code:title=pom.xml|borderStyle=solid}
<build>
	<resources>
		<resource>
			<directory>${basedir}/target/classes</directory>
		</resource>
	</resources>

	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-resources-plugin</artifactId>
			<version>2.6</version>
			<executions>
				<execution>
					<id>copy-resources</id>
					<phase>compile</phase>
					<goals>
						<goal>copy-resources</goal>
					</goals>
					<configuration>
						<outputDirectory>${basedir}/target/classes</outputDirectory>
						<resources>
							<resource>
								<directory>src/main/filtered-resources</directory>
								<filtering>true</filtering>
							</resource>
							<resource>
								<directory>src/main/resources</directory>
								<filtering>false</filtering>
							</resource>
						</resources>
					</configuration>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>
{code}


was (Author: mariusz):
Hi, I've had the same problem, but You can hack it a wee bit like that:
{code:title=pom.xml|borderStyle=solid}
<build>
	<resources>
		<resource>
			<directory>${basedir}/target/classes</directory>
		</resource>
	</resources>

	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-resources-plugin</artifactId>
			<version>2.6</version>
			<executions>
				<execution>
					<id>copy-resources</id>
					<phase>compile</phase>
					<goals>
						<goal>copy-resources</goal>
					</goals>
					<configuration>
						<outputDirectory>${basedir}/target/classes</outputDirectory>
						<resources>
							<resource>
								<directory>src/main/filtered-resources</directory>
								<filtering>true</filtering>
							</resource>
							<resource>
								<directory>src/main/resources</directory>
								<filtering>false</filtering>
							</resource>
						</resources>
					</configuration>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>
{code}

> karaf-maven-plugin can not include filtered resources in a custom distribution
> ------------------------------------------------------------------------------
>
>                 Key: KARAF-2742
>                 URL: https://issues.apache.org/jira/browse/KARAF-2742
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-tooling
>    Affects Versions: 3.0.0
>         Environment: Fedora 20, Oracle JDK 1.7.0_51, Maven 3.0.4
>            Reporter: Partha Roy
>            Assignee: Jean-Baptiste Onofré
>             Fix For: 4.0.0, 3.0.2
>
>         Attachments: CreateArchiveMojo.patch, karaf-filtering-bug.tar.gz
>
>
> I am trying to build a custom Karaf distribution by following http://karaf.apache.org/manual/latest/developers-guide/custom-distribution.html. I need to add a .cfg file in the karaf/etc directory. However, the maven resource filtering on that .cfg file does not work.
> The sample project looks like:
> {code}
> karaf-filtering-bug
> ├── pom.xml
> ├── readme.txt
> └── src
>     └── main
>         └── filtered-resources
>             └── etc
>                 └── filtering.bug.cfg
> {code}
> The filtering.bug.cfg file should be filtered with maven resource plugin. I am expecting that the filtered file will get included in the karaf distribution. I can see that target/classes/etc/filtering.bug.cfg actually has the correct content but the karaf/etc/filtering.bug.cfg still has the maven variables.
> I'll upload the sample project as well.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)