You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jason Winnebeck <jp...@rit.edu> on 2011/09/28 20:02:54 UTC

Deployment of REAL source and single file artifacts

I have an existing Maven project which deploys currently source, javadocs, and a jar. I realize now that the sources jar is not a real source of the project. I would like to deploy:

 1. A zip archive of the svn export of the tag created in maven-release-plugin:prepare during release:perform
 2. A single file as an artifact, but renamed (for example ./file.docx to target/artifactId-version-notes.docx), during any mvn package operation.

For the first task maven-assembly-plugin and maven-resources-plugin didn't seem appropriate. For the second task I know I can use maven-build-helper-plugin attachArtifact but it won't copy the file into target as far as I know or rename it. Assembly plugin can't be used because I'm not creating an archive, and resources plugin only appears to work on directories and not support renaming.

Right now I perform both tasks manually, but then the artifacts are not uploaded to the repository. Right now I take svn export of target/checkout after release:perform runs, and make a zip, and copy+rename the file.docx manually and manually bundle those into my real release.

Is there a way to automate this with Maven?

Jason Winnebeck
Systems Modernization and Sustainment Center
Rochester Institute of Technology
CIMS 78-1220
133 Lomb Memorial Drive
Rochester, New York, 14623-5608
585-475-2052
jpwasp@rit.edu

CONFIDENTIALITY NOTE: 
The information transmitted, including attachments, is intended only for the person(s) or entity to which it is addressed and may contain confidential and/or privileged material.  Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited.  If you received this transmission in error, please contact the sender and destroy any copies of this information.


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


Re: Deployment of REAL source and single file artifacts

Posted by Jason Winnebeck <jp...@rit.edu>.
Well I can see some point to that. There are scm tags in the POM where you can 
download the source. In this case I like to think of this more like giving me 
the files I would put on a website. On the site I would want the real jar, 
javadocs, sources, and a real, compilable source code. The second file I have 
been talking about is more like a changelog readme. What I want to do when I 
make a release is just copy files out of target (or my Nexus instance) and 
give them to my customer and not have to manually svn export and zip and such, 
while still having them in my Nexus repository for easy download later or from 
other Maven projects.

Jason

On 9/28/2011 5:01 PM, Thiessen, Todd (Todd) wrote:
> Ahh yes. It isn't meant for software development. It is the source you can debug through.  I think of this as the "real" source. Your terminology threw me for a loop.
>
> Software you development from is usually denoted as a trunk or branch that you check out from source control. I find it unusual to download the source from a maven repository, unpack it and start modifying it.
>
>> -----Original Message-----
>> From: Jason Winnebeck [mailto:jpwasp@rit.edu]
>> Sent: Wednesday, September 28, 2011 4:50 PM
>> To: Maven Users List
>> Subject: Re: Deployment of REAL source and single file artifacts
>>
>> Well, you can't unpack that jar then run mvn, because there's no
>> pom.xml in
>> the root. I think there is a way to get the POM in there but it goes
>> into
>> META-INF. It also never seems to include files like README, COPYING,
>> NOTICE,
>> etc. The sources jar also doesn't have my layout with src/main/java
>> etc. You
>> can't compile it. You can't run Maven with it. It doesn't include
>> copyright or
>> license files or even Apache's own NOTICE files. You can't rebuild the
>> binary
>> with it (L/GPL compliance). You can't run the unit tests with it.
>>
>> So in pretty much every way I can think of, it doesn't meet the
>> criteria of
>> proper source code. It's a source reference jar. Wonderfully
>> appropriate for
>> use as reference in your favorite IDE. Completely inappropriate for
>> software
>> development.
>>
>> Actually when I saw Maven's repo I was very pleased because at first I
>> thought
>> it had solved the GPL issue like Debian did where you get a src-deb.
>> But it
>> didn't. The -sources.jar doesn't meet the requirements of the GPL to
>> distribute that. So technically it seems to me that the typical project
>> in
>> maven central repository is not compliant with licenses like L/GPL
>> because you
>> aren't given an opportunity to download source nor a written notice to
>> obtain
>> the source that is capable of producing the binary. In this sense Maven
>> totally missed a huge opportunity to assist people in actual, proper
>> L/GPL
>> compliance where you can use maven-dependency-plugin to include
>> dependency
>> source. Now it is not legitimately practical to deliver a self-
>> contained
>> program that a user can run using Maven alone.
>>
>> Since I'm actually wanting to distribute source that I intend people to
>> open
>> and modify, I need an archive that has that. Anders's suggestion
>> achieved that
>> (based on example from Apache).
>>
>> Jason
>>
>> On 9/28/2011 4:35 PM, Thiessen, Todd (Todd) wrote:
>>> It's not the sources?  Then what is it?  It's the actual source for
>> any release that I have ever done ;-).  How do you define REAL source?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>


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


RE: Deployment of REAL source and single file artifacts

Posted by "Thiessen, Todd (Todd)" <tt...@avaya.com>.
Ahh yes. It isn't meant for software development. It is the source you can debug through.  I think of this as the "real" source. Your terminology threw me for a loop.

Software you development from is usually denoted as a trunk or branch that you check out from source control. I find it unusual to download the source from a maven repository, unpack it and start modifying it.

> -----Original Message-----
> From: Jason Winnebeck [mailto:jpwasp@rit.edu]
> Sent: Wednesday, September 28, 2011 4:50 PM
> To: Maven Users List
> Subject: Re: Deployment of REAL source and single file artifacts
> 
> Well, you can't unpack that jar then run mvn, because there's no
> pom.xml in
> the root. I think there is a way to get the POM in there but it goes
> into
> META-INF. It also never seems to include files like README, COPYING,
> NOTICE,
> etc. The sources jar also doesn't have my layout with src/main/java
> etc. You
> can't compile it. You can't run Maven with it. It doesn't include
> copyright or
> license files or even Apache's own NOTICE files. You can't rebuild the
> binary
> with it (L/GPL compliance). You can't run the unit tests with it.
> 
> So in pretty much every way I can think of, it doesn't meet the
> criteria of
> proper source code. It's a source reference jar. Wonderfully
> appropriate for
> use as reference in your favorite IDE. Completely inappropriate for
> software
> development.
> 
> Actually when I saw Maven's repo I was very pleased because at first I
> thought
> it had solved the GPL issue like Debian did where you get a src-deb.
> But it
> didn't. The -sources.jar doesn't meet the requirements of the GPL to
> distribute that. So technically it seems to me that the typical project
> in
> maven central repository is not compliant with licenses like L/GPL
> because you
> aren't given an opportunity to download source nor a written notice to
> obtain
> the source that is capable of producing the binary. In this sense Maven
> totally missed a huge opportunity to assist people in actual, proper
> L/GPL
> compliance where you can use maven-dependency-plugin to include
> dependency
> source. Now it is not legitimately practical to deliver a self-
> contained
> program that a user can run using Maven alone.
> 
> Since I'm actually wanting to distribute source that I intend people to
> open
> and modify, I need an archive that has that. Anders's suggestion
> achieved that
> (based on example from Apache).
> 
> Jason
> 
> On 9/28/2011 4:35 PM, Thiessen, Todd (Todd) wrote:
> > It's not the sources?  Then what is it?  It's the actual source for
> any release that I have ever done ;-).  How do you define REAL source?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org


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


Re: Deployment of REAL source and single file artifacts

Posted by Jason Winnebeck <jp...@rit.edu>.
Well, you can't unpack that jar then run mvn, because there's no pom.xml in 
the root. I think there is a way to get the POM in there but it goes into 
META-INF. It also never seems to include files like README, COPYING, NOTICE, 
etc. The sources jar also doesn't have my layout with src/main/java etc. You 
can't compile it. You can't run Maven with it. It doesn't include copyright or 
license files or even Apache's own NOTICE files. You can't rebuild the binary 
with it (L/GPL compliance). You can't run the unit tests with it.

So in pretty much every way I can think of, it doesn't meet the criteria of 
proper source code. It's a source reference jar. Wonderfully appropriate for 
use as reference in your favorite IDE. Completely inappropriate for software 
development.

Actually when I saw Maven's repo I was very pleased because at first I thought 
it had solved the GPL issue like Debian did where you get a src-deb. But it 
didn't. The -sources.jar doesn't meet the requirements of the GPL to 
distribute that. So technically it seems to me that the typical project in 
maven central repository is not compliant with licenses like L/GPL because you 
aren't given an opportunity to download source nor a written notice to obtain 
the source that is capable of producing the binary. In this sense Maven 
totally missed a huge opportunity to assist people in actual, proper L/GPL 
compliance where you can use maven-dependency-plugin to include dependency 
source. Now it is not legitimately practical to deliver a self-contained 
program that a user can run using Maven alone.

Since I'm actually wanting to distribute source that I intend people to open 
and modify, I need an archive that has that. Anders's suggestion achieved that 
(based on example from Apache).

Jason

On 9/28/2011 4:35 PM, Thiessen, Todd (Todd) wrote:
> It's not the sources?  Then what is it?  It's the actual source for any release that I have ever done ;-).  How do you define REAL source?

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


RE: Deployment of REAL source and single file artifacts

Posted by "Thiessen, Todd (Todd)" <tt...@avaya.com>.
It's not the sources?  Then what is it?  It's the actual source for any release that I have ever done ;-).  How do you define REAL source?

> -----Original Message-----
> From: Jason Winnebeck [mailto:jpwasp@rit.edu]
> Sent: Wednesday, September 28, 2011 4:11 PM
> To: Maven Users List
> Subject: Re: Deployment of REAL source and single file artifacts
> 
> Thanks, that works very well. I was using Maven for awhile before I
> learned
> that the -sources.jar is not actually the project sources. If I don't
> find a
> better way to do the second task, my only other thought is to use the
> ant
> plugin to do a <copy> with build-helper, but it looked like it was
> tricky to
> get the Maven properties in there to do the renaming right.
> 
> Jason
> 
> On 9/28/2011 2:56 PM, Anders Hammar wrote:
> > For the first task, I think that this is what is done for Apache
> > projects nowadays. Either someone active on such a project could fill
> > in the blanks or you go have a look in this pom:
> > http://repo1.maven.org/maven2/org/apache/apache/10/apache-10.pom
> > Look for the profile with id "apache-release".
> >
> > /Anders
> >
> > On Wed, Sep 28, 2011 at 20:02, Jason Winnebeck<jp...@rit.edu>
> wrote:
> >>   1. A zip archive of the svn export of the tag created in maven-
> release-plugin:prepare during release:perform
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org


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


Re: Deployment of REAL source and single file artifacts

Posted by Jason Winnebeck <jp...@rit.edu>.
Thanks, that works very well. I was using Maven for awhile before I learned 
that the -sources.jar is not actually the project sources. If I don't find a 
better way to do the second task, my only other thought is to use the ant 
plugin to do a <copy> with build-helper, but it looked like it was tricky to 
get the Maven properties in there to do the renaming right.

Jason

On 9/28/2011 2:56 PM, Anders Hammar wrote:
> For the first task, I think that this is what is done for Apache
> projects nowadays. Either someone active on such a project could fill
> in the blanks or you go have a look in this pom:
> http://repo1.maven.org/maven2/org/apache/apache/10/apache-10.pom
> Look for the profile with id "apache-release".
>
> /Anders
>
> On Wed, Sep 28, 2011 at 20:02, Jason Winnebeck<jp...@rit.edu>  wrote:
>>   1. A zip archive of the svn export of the tag created in maven-release-plugin:prepare during release:perform

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


Re: Deployment of REAL source and single file artifacts

Posted by Anders Hammar <an...@hammar.net>.
For the first task, I think that this is what is done for Apache
projects nowadays. Either someone active on such a project could fill
in the blanks or you go have a look in this pom:
http://repo1.maven.org/maven2/org/apache/apache/10/apache-10.pom
Look for the profile with id "apache-release".

/Anders

On Wed, Sep 28, 2011 at 20:02, Jason Winnebeck <jp...@rit.edu> wrote:
> I have an existing Maven project which deploys currently source, javadocs, and a jar. I realize now that the sources jar is not a real source of the project. I would like to deploy:
>
>  1. A zip archive of the svn export of the tag created in maven-release-plugin:prepare during release:perform
>  2. A single file as an artifact, but renamed (for example ./file.docx to target/artifactId-version-notes.docx), during any mvn package operation.
>
> For the first task maven-assembly-plugin and maven-resources-plugin didn't seem appropriate. For the second task I know I can use maven-build-helper-plugin attachArtifact but it won't copy the file into target as far as I know or rename it. Assembly plugin can't be used because I'm not creating an archive, and resources plugin only appears to work on directories and not support renaming.
>
> Right now I perform both tasks manually, but then the artifacts are not uploaded to the repository. Right now I take svn export of target/checkout after release:perform runs, and make a zip, and copy+rename the file.docx manually and manually bundle those into my real release.
>
> Is there a way to automate this with Maven?
>
> Jason Winnebeck
> Systems Modernization and Sustainment Center
> Rochester Institute of Technology
> CIMS 78-1220
> 133 Lomb Memorial Drive
> Rochester, New York, 14623-5608
> 585-475-2052
> jpwasp@rit.edu
>
> CONFIDENTIALITY NOTE:
> The information transmitted, including attachments, is intended only for the person(s) or entity to which it is addressed and may contain confidential and/or privileged material.  Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited.  If you received this transmission in error, please contact the sender and destroy any copies of this information.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: Deployment of REAL source and single file artifacts

Posted by Jörg Schaible <jo...@gmx.de>.
Hi Jason,

Jason Winnebeck wrote:

> I didn't think it moved the file into target. I tried that and ran mvn
> package and it didn't happen. However, I checked my .m2 local repository
> after mvn install and it DOES appear in there. I just don't think it
> works.

[snip]

All I can say, that we us it since years to release and deploy XML schemas 
this way.

- Jörg


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


Re: Deployment of REAL source and single file artifacts

Posted by Jason Winnebeck <jp...@rit.edu>.
I didn't think it moved the file into target. I tried that and ran mvn package 
and it didn't happen. However, I checked my .m2 local repository after mvn 
install and it DOES appear in there. I just don't think it works.

        <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>build-helper-maven-plugin</artifactId>
         <executions>
           <execution>
             <id>attach-artifacts</id>
             <phase>package</phase>
             <goals>
               <goal>attach-artifact</goal>
             </goals>
             <configuration>
               <artifacts>
                 <artifact>
                   <file>file.docx</file>
                   <type>docx</type>
                   <classifier>notes</classifier>
                 </artifact>
               </artifacts>
             </configuration>
           </execution>
         </executions>
       </plugin>

Instead, I am doing this, which is now my solution for my second problem:

       <plugin>
         <artifactId>maven-antrun-plugin</artifactId>
         <version>1.6</version>
         <executions>
           <execution>
             <phase>package</phase>
             <configuration>
               <target>
                 ${project.build.outputDirectory}
                 <copy file="${basedir}/file.docx"
                       overwrite="true"
 
tofile="target/${project.artifactId}-${project.version}-notes.docx"/>
                 <attachartifact 
file="target/${project.artifactId}-${project.version}-notes.docx" 
classifier="notes" type="docx"/>
               </target>
             </configuration>
             <goals>
               <goal>run</goal>
             </goals>
           </execution>
         </executions>
       </plugin>

Jason

On  9/28/2011  4:48  PM,  Jörg  Schaible  wrote:
>  will  create  an  attached  artifact  with  GACV  "org.group:project:notes:47.1.1"
>  and  the  file  is  named  "project-47.1.1-notes.docx"  in  target  and  deployed  in
>  this  way  to  the  repository.

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


Re: Deployment of REAL source and single file artifacts

Posted by Jörg Schaible <jo...@gmx.de>.
Jason Winnebeck wrote:

> I have an existing Maven project which deploys currently source, javadocs,
> and a jar. I realize now that the sources jar is not a real source of the
> project. I would like to deploy:
> 
>  1. A zip archive of the svn export of the tag created in
>  maven-release-plugin:prepare during release:perform
>  2. A single file as
>  an artifact, but renamed (for example ./file.docx to
>  target/artifactId-version-notes.docx), during any mvn package operation.
> 
> For the first task maven-assembly-plugin and maven-resources-plugin didn't
> seem appropriate. For the second task I know I can use
> maven-build-helper-plugin attachArtifact but it won't copy the file into
> target as far as I know or rename it.

It does. It's exactly for this purpose.

============ %< ===========
<project>
  <groupId>org.group</groupId>
  <artifactId>project</artifactId>
  <version>47.1.1</version>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-artifacts</id>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>file.docx</file>
                  <type>docx</type>
                  <classifier>notes</classifier>
                </artifact>
              </artifacts>
            </configuration>
============ %< ===========

will create an attached artifact with GACV "org.group:project:notes:47.1.1" 
and the file is named "project-47.1.1-notes.docx" in target and deployed in 
this way to the repository.

[snip]

- Jörg


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