FAQ
Please tell me how we can add a task in POM.xml file to zip the source code
separately while build the application. I want both .war file and .zip files
independent of each other.

Thank you in advance.



-----
Madhu
--
View this message in context: http://maven.40175.n5.nabble.com/How-to-zip-the-source-code-separately-using-Maven-tp5721257.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org

Search Discussions

  • Jim McCaskey at Sep 11, 2012 at 1:22 pm
    You can use either the Maven source plugin [1] or the more generic Maven Assembly Plugin [2] if you want more control of what goes into your zip.

    -Jim


    [1] http://maven.apache.org/plugins/maven-source-plugin/
    [2] http://maven.apache.org/plugins/maven-assembly-plugin/


    -----Original Message-----
    From: Madhu
    Sent: Tuesday, September 11, 2012 8:19 AM
    To: users@maven.apache.org
    Subject: How to zip the source code separately using Maven

    Please tell me how we can add a task in POM.xml file to zip the source code
    separately while build the application. I want both .war file and .zip files
    independent of each other.

    Thank you in advance.



    -----
    Madhu
    --
    View this message in context: http://maven.40175.n5.nabble.com/How-to-zip-the-source-code-separately-using-Maven-tp5721257.html
    Sent from the Maven - Users mailing list archive at Nabble.com.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
    For additional commands, e-mail: users-help@maven.apache.org


    NOTICE: All information in and attached to this email may be proprietary, confidential, privileged and otherwise protected from improper or erroneous disclosure. If you are not the sender's intended recipient, you are not authorized to intercept, read, print, retain, copy, forward, or disseminate this message.


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
    For additional commands, e-mail: users-help@maven.apache.org
  • Thorsten Heit at Sep 11, 2012 at 1:25 pm
    Hi,
    Please tell me how we can add a task in POM.xml file to zip the source code
    separately while build the application. I want both .war file and .zip files
    independent of each other.
    https://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html
    https://maven.apache.org/plugins/maven-source-plugin/


    ?

    HTH

    Thorsten
  • Madhu at Sep 11, 2012 at 6:09 pm
    can somebody give me the sample code...



    -----
    Madhu
    --
    View this message in context: http://maven.40175.n5.nabble.com/How-to-zip-the-source-code-separately-using-Maven-tp5721257p5721311.html
    Sent from the Maven - Users mailing list archive at Nabble.com.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
    For additional commands, e-mail: users-help@maven.apache.org
  • Thorsten Heit at Sep 12, 2012 at 7:13 am
    Hi,
    can somebody give me the sample code...
    Please read the links you were given.
    What have you tried so far? And what problems do you still have?


    Regards

    Thorsten
  • Madhu at Sep 12, 2012 at 1:06 pm
    I wanted only source code but it tries to combine the whole project content
    with Jar and etc. I am getting the following error.

    Failed to execute goal
    org.apache.maven.plugins:maven-assembly-plugin:2.3:assembly (make-assembly)
    on project ABCServices: Error reading assemblies: No assembly descriptors
    found. -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e
    switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please
    read the following articles:
    [ERROR] [Help 1]
    http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException





    -----
    Madhu
    --
    View this message in context: http://maven.40175.n5.nabble.com/How-to-zip-the-source-code-separately-using-Maven-tp5721257p5721509.html
    Sent from the Maven - Users mailing list archive at Nabble.com.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
    For additional commands, e-mail: users-help@maven.apache.org
  • Thorsten Heit at Sep 12, 2012 at 1:17 pm
    Hi,
    I wanted only source code but it tries to combine the whole project content
    with Jar and etc. I am getting the following error.

    Failed to execute goal
    org.apache.maven.plugins:maven-assembly-plugin:2.3:assembly
    (make-assembly)
    on project ABCServices: Error reading assemblies: No assembly
    descriptors
    found. -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e
    switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please
    read the following articles:
    [ERROR] [Help 1]
    http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
    You haven't said what you have done so far. Have you really read the link
    you were given? They contain several examples how to use these plugins.

    Apart from that:
    If you don't give any information about what you have done, how your
    project is structured, how your pom.xml looks like, how you trigger Maven,
    what you did to see the above mentioned error etc., nobody is able and
    possibly even willing to help you resolve your problems...


    HTH

    Thorsten
  • Jim McCaskey at Sep 12, 2012 at 1:19 pm
    The documentation for the Maven Assembly Plugin [1] is pretty good (for Maven) and you'll probably find most of the answers you seek there. You are getting the error you described because you have not configured the plugin properly.

    You probably need the plugin to look something like this at minimum:

    <plugin>
    <groupId>com.pervasive.connectivity</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.3</version>
    <configuration>
    <descriptorRefs>
    <descriptorRef>src</descriptorRef>
    </descriptorRefs>
    </configuration>
    <executions>
    <execution>
    <id>make-assembly</id>
    <phase>package</phase>
    <goals>
    <goal>single</goal>
    </goals>
    </execution>
    </executions>
    </plugin>

    It's probably a good idea to spend some time with the usage page [2] at least so you can't get this working the way you want it to. The example above used the predefined src descriptor [3].

    -Jim


    [1] http://maven.apache.org/plugins/maven-assembly-plugin/
    [2] http://maven.apache.org/plugins/maven-assembly-plugin/usage.html
    [3] http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#src





    -----Original Message-----
    From: Madhu
    Sent: Wednesday, September 12, 2012 8:06 AM
    To: users@maven.apache.org
    Subject: Re: Re: How to zip the source code separately using Maven

    I wanted only source code but it tries to combine the whole project content
    with Jar and etc. I am getting the following error.

    Failed to execute goal
    org.apache.maven.plugins:maven-assembly-plugin:2.3:assembly (make-assembly)
    on project ABCServices: Error reading assemblies: No assembly descriptors
    found. -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e
    switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please
    read the following articles:
    [ERROR] [Help 1]
    http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException





    -----
    Madhu
    --
    View this message in context: http://maven.40175.n5.nabble.com/How-to-zip-the-source-code-separately-using-Maven-tp5721257p5721509.html
    Sent from the Maven - Users mailing list archive at Nabble.com.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
    For additional commands, e-mail: users-help@maven.apache.org


    NOTICE: All information in and attached to this email may be proprietary, confidential, privileged and otherwise protected from improper or erroneous disclosure. If you are not the sender's intended recipient, you are not authorized to intercept, read, print, retain, copy, forward, or disseminate this message.


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
    For additional commands, e-mail: users-help@maven.apache.org
  • Madhu at Sep 12, 2012 at 1:26 pm
    This is how my code looks which I wrote:
    This is my source.xml file
    <assembly
    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0
    " rel="nofollow">http://maven.apache.org/xsd/assembly-1.1.0.xsd">
    <id>src</id>
    <formats>
    <format>zip</format>
    </formats>
    <fileSets>
    <fileSet>
    <directory>${project.basedir}</directory>
    <includes>
    <include>src/main/*.java</include>
    <include>src/main/resources/*.*</include>
    <include>pom.xml</include>
    </includes>
    <useDefaultExcludes>true</useDefaultExcludes>
    </fileSet>
    <fileSet>

    <directory>${project.basedir}/src/main</directory>
    <useDefaultExcludes>true</useDefaultExcludes>
    </fileSet>
    </fileSets>
    </assembly>

    and in the pom.xml I have written this


    <plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.3</version>
    <configuration>
    <descriptors>
    <descriptor>src/assemble/source.xml</descriptor>
    </descriptors>
    </configuration>
    </plugin>

    I am not able to understand about goal and where to define the same.

    Please advice me what I am missing to make it work correctly.

    Thank you.





    -----
    Madhu
    --
    View this message in context: http://maven.40175.n5.nabble.com/How-to-zip-the-source-code-separately-using-Maven-tp5721257p5721532.html
    Sent from the Maven - Users mailing list archive at Nabble.com.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
    For additional commands, e-mail: users-help@maven.apache.org
  • Curtis Rueden at Sep 12, 2012 at 6:34 pm
    Hi Madhu,

    As suggested earlier, did you try the maven-source-plugin? It might be
    easier for you.

    <plugin>
    <artifactId>maven-source-plugin</artifactId>
    <version>2.1.2</version>
    <!-- Build source JARs in addition to binary ones. -->
    <executions>
    <execution>
    <goals>
    <goal>jar</goal>
    </goals>
    </execution>
    </executions>
    </plugin>

    This will generate a JAR file like target/myArtifact-x.y.z-sources.jar
    containing your sources and resources with Maven metadata including the
    POM. You can even deploy the sources JAR to your Maven repository so that
    other developers on your team have easy access to the code that goes along
    with each binary release.

    Alternately, if you really want to use the assembly plugin... your error
    message indicates that no descriptors are configured, which is strange
    given your plugin block in the POM. Are you using "mvn assembly:single"?
    Did you try adding the <executions> block suggested by Jim and just using
    "mvn package" to create the assembly?

    HTH,
    Curtis

    On Wed, Sep 12, 2012 at 8:26 AM, Madhu wrote:

    This is how my code looks which I wrote:
    This is my source.xml file
    <assembly
    xmlns="
    http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:schemaLocation="
    http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0
    " rel="nofollow">http://maven.apache.org/xsd/assembly-1.1.0.xsd">
    <id>src</id>
    <formats>
    <format>zip</format>
    </formats>
    <fileSets>
    <fileSet>
    <directory>${project.basedir}</directory>
    <includes>
    <include>src/main/*.java</include>
    <include>src/main/resources/*.*</include>
    <include>pom.xml</include>
    </includes>
    <useDefaultExcludes>true</useDefaultExcludes>
    </fileSet>
    <fileSet>

    <directory>${project.basedir}/src/main</directory>
    <useDefaultExcludes>true</useDefaultExcludes>
    </fileSet>
    </fileSets>
    </assembly>

    and in the pom.xml I have written this


    <plugin>

    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.3</version>
    <configuration>
    <descriptors>

    <descriptor>src/assemble/source.xml</descriptor>
    </descriptors>
    </configuration>
    </plugin>

    I am not able to understand about goal and where to define the same.

    Please advice me what I am missing to make it work correctly.

    Thank you.





    -----
    Madhu
    --
    View this message in context:
    http://maven.40175.n5.nabble.com/How-to-zip-the-source-code-separately-using-Maven-tp5721257p5721532.html
    Sent from the Maven - Users mailing list archive at Nabble.com.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
    For additional commands, e-mail: users-help@maven.apache.org
  • Madhu at Sep 13, 2012 at 3:58 pm
    Thank you guys for your help.

    I have a question is there any order for writing the plugins. I wrote my
    source plugin at the end it is not doing anything. Another question is what
    is the difference between defining the plugin at project-->plugin vs
    project-->profile.

    the code which I wrote in project --> plugin are is as given below:
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-source-plugin</artifactId>
    <version>2.2</version>
    <executions>
    <execution>
    <id>attach-source</id>
    <phase>verify</phase>
    <goals>
    <goal>jar</goal>
    <goal>test-jar</goal>
    </goals>
    <configuration>
    <finalName>mySource</finalName>
    <forceCreation>true</forceCreation>
    <includePom>true</includePom>
    <outputDirectory>${basedir}/target</outputDirectory>
    </configuration>
    </execution>
    </executions>
    </plugin>

    can we write the code in both plugin and profile areas.

    Thank you.



    -----
    Madhu
    --
    View this message in context: http://maven.40175.n5.nabble.com/How-to-zip-the-source-code-separately-using-Maven-tp5721257p5721720.html
    Sent from the Maven - Users mailing list archive at Nabble.com.

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
    For additional commands, e-mail: users-help@maven.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriesmaven
postedSep 11, '12 at 1:19p
activeSep 13, '12 at 3:58p
posts11
users4
websitemaven.apache.org
irc#maven

People

Translate

site design / logo © 2022 Grokbase