You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Mohammad Shamsi <m....@gmail.com> on 2015/02/02 15:06:25 UTC
karaf-maven-plugin is ignoring the"targetFile" parameter
Hi All,
I'm using karaf-maven-plugin to create a customized distribution tar file.
The final tar.gz file name always following the artifact name. I did try to
use "finaName" and "targetFile" in configuration, but didn't work.
Looking at plugin source code, it seems that it's ignoring the "targetFile"
parameter during archive creation.
Is this a bug or I am missing something?
Cheers,
Re: karaf-maven-plugin is ignoring the"targetFile" parameter
Posted by Mohammad Shamsi <m....@gmail.com>.
Great. thanks
On Mon Feb 02 2015 at 6:43:56 PM Jean-Baptiste Onofré <jb...@nanthrax.net>
wrote:
> I created the Jira and I'm fixing it:
>
> https://issues.apache.org/jira/browse/KARAF-3493
>
> Regards
> JB
>
> On 02/02/2015 06:12 PM, Mohammad Shamsi wrote:
> > Hi,
> >
> > I am using karaf-assembly, following the documentation here :
> > http://karaf.apache.org/manual/latest/developers-
> guide/custom-distribution.html
> >
> > Following you suggested solution, the result still is the same. maven
> > artifact name and version is used for tar.gz file.
> >
> > As I mentioned in the email, the "targetFile" parameter is there and one
> > can specify the value for it, but this value is being ignored in the
> code.
> >
> > Here is the code snippet from "CreateArchieveMojo.java" that I think
> > ignoring the "targetFile" and using the artifact Id and version to
> > generation the archive:
> >
> > publicFilearchive(File source,File dest,Artifact
> artifact)throwsIOException {
> > String serverName = artifact.getArtifactId() +"-"+
> artifact.getVersion();
> > dest =newFile(dest,serverName +"."+ artifact.getType());
> > Project project =newProject();
> > MatchingTask archiver;
> > if("tar.gz".equals(artifact.getType())) {
> >
> >
> > Cheers,
> >
> > On Mon Feb 02 2015 at 5:57:27 PM Jean-Baptiste Onofré <jb@nanthrax.net
> > <ma...@nanthrax.net>> wrote:
> >
> > Hi Mohammad,
> >
> > which goal are you using ? I guess just install-kar, right ?
> >
> > You have to specify the instance-create-archive goal, which take the
> > result of the install-kar goal (target/assembly), and package as an
> > archive (zip/tar.gz archives).
> > This goal accepts a targetFile parameter.
> >
> > So you can do:
> >
> > <plugin>
> > <groupId>org.apache.karaf.__tooling</groupId>
> > <artifactId>karaf-maven-__plugin</artifactId>
> > <executions>
> > <execution>
> > <id>process-resources</id>
> > <phase>process-resources</__phase>
> > <goals>
> > <goal>install-kars</goal>
> > </goals>
> > </execution>
> > <execution>
> > <id>package</id>
> > <goals>
> > <goal>instance-create-archive<__/goal>
> > </goals>
> > <configuration>
> > <targetFile>my-file</__targetFile>
> > </configuration>
> > </execution>
> > </executions>
> > </plugin>
> >
> >
> > Regards
> > JB
> >
> > On 02/02/2015 03:06 PM, Mohammad Shamsi wrote:
> > > Hi All,
> > >
> > > I'm using karaf-maven-plugin to create a customized distribution
> > tar file.
> > > The final tar.gz file name always following the artifact name. I
> > did try
> > > to use "finaName" and "targetFile" in configuration, but didn't
> work.
> > >
> > > Looking at plugin source code, it seems that it's ignoring the
> > > "targetFile" parameter during archive creation.
> > >
> > > Is this a bug or I am missing something?
> > >
> > > Cheers,
> >
> > --
> > Jean-Baptiste Onofré
> > jbonofre@apache.org <ma...@apache.org>
> > http://blog.nanthrax.net
> > Talend - http://www.talend.com
> >
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>
Re: karaf-maven-plugin is ignoring the"targetFile" parameter
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
I created the Jira and I'm fixing it:
https://issues.apache.org/jira/browse/KARAF-3493
Regards
JB
On 02/02/2015 06:12 PM, Mohammad Shamsi wrote:
> Hi,
>
> I am using karaf-assembly, following the documentation here :
> http://karaf.apache.org/manual/latest/developers-guide/custom-distribution.html
>
> Following you suggested solution, the result still is the same. maven
> artifact name and version is used for tar.gz file.
>
> As I mentioned in the email, the "targetFile" parameter is there and one
> can specify the value for it, but this value is being ignored in the code.
>
> Here is the code snippet from "CreateArchieveMojo.java" that I think
> ignoring the "targetFile" and using the artifact Id and version to
> generation the archive:
>
> publicFilearchive(File source,File dest,Artifact artifact)throwsIOException {
> String serverName = artifact.getArtifactId() +"-"+ artifact.getVersion();
> dest =newFile(dest,serverName +"."+ artifact.getType());
> Project project =newProject();
> MatchingTask archiver;
> if("tar.gz".equals(artifact.getType())) {
>
>
> Cheers,
>
> On Mon Feb 02 2015 at 5:57:27 PM Jean-Baptiste Onofré <jb@nanthrax.net
> <ma...@nanthrax.net>> wrote:
>
> Hi Mohammad,
>
> which goal are you using ? I guess just install-kar, right ?
>
> You have to specify the instance-create-archive goal, which take the
> result of the install-kar goal (target/assembly), and package as an
> archive (zip/tar.gz archives).
> This goal accepts a targetFile parameter.
>
> So you can do:
>
> <plugin>
> <groupId>org.apache.karaf.__tooling</groupId>
> <artifactId>karaf-maven-__plugin</artifactId>
> <executions>
> <execution>
> <id>process-resources</id>
> <phase>process-resources</__phase>
> <goals>
> <goal>install-kars</goal>
> </goals>
> </execution>
> <execution>
> <id>package</id>
> <goals>
> <goal>instance-create-archive<__/goal>
> </goals>
> <configuration>
> <targetFile>my-file</__targetFile>
> </configuration>
> </execution>
> </executions>
> </plugin>
>
>
> Regards
> JB
>
> On 02/02/2015 03:06 PM, Mohammad Shamsi wrote:
> > Hi All,
> >
> > I'm using karaf-maven-plugin to create a customized distribution
> tar file.
> > The final tar.gz file name always following the artifact name. I
> did try
> > to use "finaName" and "targetFile" in configuration, but didn't work.
> >
> > Looking at plugin source code, it seems that it's ignoring the
> > "targetFile" parameter during archive creation.
> >
> > Is this a bug or I am missing something?
> >
> > Cheers,
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org <ma...@apache.org>
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com
Re: karaf-maven-plugin is ignoring the"targetFile" parameter
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
The MOJO uses the targetFile:
artifact.setFile(targetFile);
but you are right, it doesn't use the targetFile configuration and
construct the filename using artifactId + "-" + version.
Let me create the Jira to fix that.
Sorry about that.
Regards
JB
On 02/02/2015 06:12 PM, Mohammad Shamsi wrote:
> Hi,
>
> I am using karaf-assembly, following the documentation here :
> http://karaf.apache.org/manual/latest/developers-guide/custom-distribution.html
>
> Following you suggested solution, the result still is the same. maven
> artifact name and version is used for tar.gz file.
>
> As I mentioned in the email, the "targetFile" parameter is there and one
> can specify the value for it, but this value is being ignored in the code.
>
> Here is the code snippet from "CreateArchieveMojo.java" that I think
> ignoring the "targetFile" and using the artifact Id and version to
> generation the archive:
>
> publicFilearchive(File source,File dest,Artifact artifact)throwsIOException {
> String serverName = artifact.getArtifactId() +"-"+ artifact.getVersion();
> dest =newFile(dest,serverName +"."+ artifact.getType());
> Project project =newProject();
> MatchingTask archiver;
> if("tar.gz".equals(artifact.getType())) {
>
>
> Cheers,
>
> On Mon Feb 02 2015 at 5:57:27 PM Jean-Baptiste Onofré <jb@nanthrax.net
> <ma...@nanthrax.net>> wrote:
>
> Hi Mohammad,
>
> which goal are you using ? I guess just install-kar, right ?
>
> You have to specify the instance-create-archive goal, which take the
> result of the install-kar goal (target/assembly), and package as an
> archive (zip/tar.gz archives).
> This goal accepts a targetFile parameter.
>
> So you can do:
>
> <plugin>
> <groupId>org.apache.karaf.__tooling</groupId>
> <artifactId>karaf-maven-__plugin</artifactId>
> <executions>
> <execution>
> <id>process-resources</id>
> <phase>process-resources</__phase>
> <goals>
> <goal>install-kars</goal>
> </goals>
> </execution>
> <execution>
> <id>package</id>
> <goals>
> <goal>instance-create-archive<__/goal>
> </goals>
> <configuration>
> <targetFile>my-file</__targetFile>
> </configuration>
> </execution>
> </executions>
> </plugin>
>
>
> Regards
> JB
>
> On 02/02/2015 03:06 PM, Mohammad Shamsi wrote:
> > Hi All,
> >
> > I'm using karaf-maven-plugin to create a customized distribution
> tar file.
> > The final tar.gz file name always following the artifact name. I
> did try
> > to use "finaName" and "targetFile" in configuration, but didn't work.
> >
> > Looking at plugin source code, it seems that it's ignoring the
> > "targetFile" parameter during archive creation.
> >
> > Is this a bug or I am missing something?
> >
> > Cheers,
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org <ma...@apache.org>
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com
Re: karaf-maven-plugin is ignoring the"targetFile" parameter
Posted by Mohammad Shamsi <m....@gmail.com>.
Hi,
I am using karaf-assembly, following the documentation here :
http://karaf.apache.org/manual/latest/developers-guide/custom-distribution.html
Following you suggested solution, the result still is the same. maven
artifact name and version is used for tar.gz file.
As I mentioned in the email, the "targetFile" parameter is there and one
can specify the value for it, but this value is being ignored in the code.
Here is the code snippet from "CreateArchieveMojo.java" that I think
ignoring the "targetFile" and using the artifact Id and version to
generation the archive:
public File archive(File source, File dest, Artifact artifact) throws
IOException {
String serverName = artifact.getArtifactId() + "-" + artifact.getVersion();
dest = new File(dest, serverName + "." + artifact.getType());
Project project = new Project();
MatchingTask archiver;
if ("tar.gz".equals(artifact.getType())) {
Cheers,
On Mon Feb 02 2015 at 5:57:27 PM Jean-Baptiste Onofré <jb...@nanthrax.net>
wrote:
> Hi Mohammad,
>
> which goal are you using ? I guess just install-kar, right ?
>
> You have to specify the instance-create-archive goal, which take the
> result of the install-kar goal (target/assembly), and package as an
> archive (zip/tar.gz archives).
> This goal accepts a targetFile parameter.
>
> So you can do:
>
> <plugin>
> <groupId>org.apache.karaf.tooling</groupId>
> <artifactId>karaf-maven-plugin</artifactId>
> <executions>
> <execution>
> <id>process-resources</id>
> <phase>process-resources</phase>
> <goals>
> <goal>install-kars</goal>
> </goals>
> </execution>
> <execution>
> <id>package</id>
> <goals>
> <goal>instance-create-archive</goal>
> </goals>
> <configuration>
> <targetFile>my-file</targetFile>
> </configuration>
> </execution>
> </executions>
> </plugin>
>
>
> Regards
> JB
>
> On 02/02/2015 03:06 PM, Mohammad Shamsi wrote:
> > Hi All,
> >
> > I'm using karaf-maven-plugin to create a customized distribution tar
> file.
> > The final tar.gz file name always following the artifact name. I did try
> > to use "finaName" and "targetFile" in configuration, but didn't work.
> >
> > Looking at plugin source code, it seems that it's ignoring the
> > "targetFile" parameter during archive creation.
> >
> > Is this a bug or I am missing something?
> >
> > Cheers,
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>
Re: karaf-maven-plugin is ignoring the"targetFile" parameter
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Mohammad,
which goal are you using ? I guess just install-kar, right ?
You have to specify the instance-create-archive goal, which take the
result of the install-kar goal (target/assembly), and package as an
archive (zip/tar.gz archives).
This goal accepts a targetFile parameter.
So you can do:
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<executions>
<execution>
<id>process-resources</id>
<phase>process-resources</phase>
<goals>
<goal>install-kars</goal>
</goals>
</execution>
<execution>
<id>package</id>
<goals>
<goal>instance-create-archive</goal>
</goals>
<configuration>
<targetFile>my-file</targetFile>
</configuration>
</execution>
</executions>
</plugin>
Regards
JB
On 02/02/2015 03:06 PM, Mohammad Shamsi wrote:
> Hi All,
>
> I'm using karaf-maven-plugin to create a customized distribution tar file.
> The final tar.gz file name always following the artifact name. I did try
> to use "finaName" and "targetFile" in configuration, but didn't work.
>
> Looking at plugin source code, it seems that it's ignoring the
> "targetFile" parameter during archive creation.
>
> Is this a bug or I am missing something?
>
> Cheers,
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com