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é <[email protected]
<mailto:[email protected]>> 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é
    [email protected] <mailto:[email protected]>
    http://blog.nanthrax.net
    Talend - http://www.talend.com


--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to