You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Adam Lally <al...@alum.rpi.edu> on 2007/02/15 17:36:57 UTC

Trouble adding common resouce files to all jars

Hello,

I am trying to add some common resource files to all of my jars in a
multimodule project, without having to copy the files to all the
src/main/resources directories in every single module.  (In particular
this is for LICENSE and NOTICE files that are required in the jars for
our Apache incubator project.)

We tried adding the following to our parent POM (we use the flat layout):

  <build>
    <resources>
      <resource>
        <targetPath>META-INF</targetPath>
        <filtering>false</filtering>
        <directory>../uimaj-distr/src/main/readme/</directory>
        <includes>
          <include>LICENSE</include>
          <include>NOTICE</include>
        </includes>
      </resource>
    </resources>
    ...
  </build>


However this causes _hundreds_ of unit tests to fail when I run "mvn
clean install".  The surefire-reports contain NoClassDefFoundErrors
but do not say the name of the class that's not found.

If I remove the <resources> element, everything builds fine.

So far I have not been able to reproduce this in a small test case, so
I don't know what else might be contributing to the problem.

Any ideas?

Thanks,
  -Adam

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


Fwd: Trouble adding common resouce files to all jars

Posted by Adam Lally <al...@alum.rpi.edu>.
FYI, follow up about the Maven issue:

I tried it and it basically gets the license, notice, disclaimer files
from a remote source and includes them automatically.

It works, but... it pulls the name of the project from the POM for
each jar, so in the disclaimer for uima-core it would say:
Apache UIMA Java Framework Core is an effort undergoing incubation,
blah blah blah.

I asked if there was a way to override that name, he said no but he
would open a JIRA issue for them to do that.

---------- Forwarded message ----------
From: Daniel Kulp <da...@iona.com>
Date: Feb 15, 2007 1:07 PM
Subject: Re: Trouble adding common resouce files to all jars
To: users@maven.apache.org


On Thursday 15 February 2007 12:18, Adam Lally wrote:
> Thanks, that worked.  However, is there a way to override the name of
> the project that is written to the NOTICES and DISCLAIMER files?
> Currently each jar file uses its own artifact name (e.g. "Apache UIMA
> Java Framework Core") when really we want just the name of our project
> ("Apache UIMA").

Hmm....   nope.   Not possible right now.   The velocity script uses
project.name which evaluates to what's in the pom.  I've logged a bug:

http://jira.codehaus.org/browse/MRRESOURCES-12


--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com

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

Re: Trouble adding common resouce files to all jars

Posted by Daniel Kulp <da...@iona.com>.
On Thursday 15 February 2007 12:18, Adam Lally wrote:
> Thanks, that worked.  However, is there a way to override the name of
> the project that is written to the NOTICES and DISCLAIMER files?
> Currently each jar file uses its own artifact name (e.g. "Apache UIMA
> Java Framework Core") when really we want just the name of our project
> ("Apache UIMA").

Hmm....   nope.   Not possible right now.   The velocity script uses 
project.name which evaluates to what's in the pom.  I've logged a bug:

http://jira.codehaus.org/browse/MRRESOURCES-12


-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com

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


Fwd: Trouble adding common resouce files to all jars

Posted by Adam Lally <al...@alum.rpi.edu>.
The latest on the Maven resources build issue.  The
maven-remote-resources plugin could be a solution for us now (an
alternative to putting the NOTICES and DISCLAIMER in all of our
projects).  However it is still marked as an alpha SNAPSHOT, and also
by its very nature it is getting the NOTICES and DISCLAIMER content
from a remote repository, so we'd rely on that content being correctly
maintained.  I'm not sure it's worth it to use this yet.

In any case, <resources> really should work!  I haven't gotten any
suggestions yet and why it might be broken, and I wasn't able to
reproduce in a simple test case.

-Adam

---------- Forwarded message ----------
From: Daniel Kulp <da...@iona.com>
Date: Feb 15, 2007 6:00 PM
Subject: Re: Trouble adding common resouce files to all jars
To: users@maven.apache.org


On Thursday 15 February 2007 17:49, Jason van Zyl wrote:
> On 15 Feb 07, at 5:05 PM 15 Feb 07, Daniel Kulp wrote:
> > Adam,
> >
> >> Thanks, that worked.  However, is there a way to override the name of
> >> the project that is written to the NOTICES and DISCLAIMER files?
> >> Currently each jar file uses its own artifact name (e.g. "Apache UIMA
> >> Java Framework Core") when really we want just the name of our
> >> project
> >> ("Apache UIMA").
> >
> > I've deployed a SNAPSHOT that adds this.   Change to:
> > <resourceBundle>org.apache:apache-jar-resource-bundle:1.1.1-
> > SNAPSHOT</resourceBundle>
> >
> > and change the properties to:
> >                  <properties>
> >                      <addLicense>true</addLicense>
>
>                       Can you make that projectName to keep the naming convention
> consistent.

Good point.   Done.   It should now be:

                 <properties>
                     <addLicense>true</addLicense>
                     <projectName>Apache UIMA</projectName>
                 </properties>


Dan


> >                      <project_name>Apache UIMA</project_name>
> >                  </properties>
> >
> > and that should work.   Eventually, the maven teem will need to get
> > this
> > released for you, but I want to hold off a bit to see what other
> > bugs/issues
> > will pop up as other projects start using it.   (The whole remote-
> > resources
> > thing is very new)
> >
> >
> > --
> > J. Daniel Kulp
> > Principal Engineer
> > IONA
> > P: 781-902-8727    C: 508-380-7194
> > daniel.kulp@iona.com
> >
> > ---------------------------------------------------------------------
> > 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

--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com

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

Re: Trouble adding common resouce files to all jars

Posted by Daniel Kulp <da...@iona.com>.
On Thursday 15 February 2007 17:49, Jason van Zyl wrote:
> On 15 Feb 07, at 5:05 PM 15 Feb 07, Daniel Kulp wrote:
> > Adam,
> >
> >> Thanks, that worked.  However, is there a way to override the name of
> >> the project that is written to the NOTICES and DISCLAIMER files?
> >> Currently each jar file uses its own artifact name (e.g. "Apache UIMA
> >> Java Framework Core") when really we want just the name of our
> >> project
> >> ("Apache UIMA").
> >
> > I've deployed a SNAPSHOT that adds this.   Change to:
> > <resourceBundle>org.apache:apache-jar-resource-bundle:1.1.1-
> > SNAPSHOT</resourceBundle>
> >
> > and change the properties to:
> >                  <properties>
> >                      <addLicense>true</addLicense>
>
> 			Can you make that projectName to keep the naming convention
> consistent.

Good point.   Done.   It should now be:

                 <properties>
                     <addLicense>true</addLicense>
                     <projectName>Apache UIMA</projectName>
                 </properties>


Dan


> >                      <project_name>Apache UIMA</project_name>
> >                  </properties>
> >
> > and that should work.   Eventually, the maven teem will need to get
> > this
> > released for you, but I want to hold off a bit to see what other
> > bugs/issues
> > will pop up as other projects start using it.   (The whole remote-
> > resources
> > thing is very new)
> >
> >
> > --
> > J. Daniel Kulp
> > Principal Engineer
> > IONA
> > P: 781-902-8727    C: 508-380-7194
> > daniel.kulp@iona.com
> >
> > ---------------------------------------------------------------------
> > 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

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com

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


Re: Trouble adding common resouce files to all jars

Posted by Jason van Zyl <ja...@maven.org>.
On 15 Feb 07, at 5:05 PM 15 Feb 07, Daniel Kulp wrote:

> Adam,
>
>> Thanks, that worked.  However, is there a way to override the name of
>> the project that is written to the NOTICES and DISCLAIMER files?
>> Currently each jar file uses its own artifact name (e.g. "Apache UIMA
>> Java Framework Core") when really we want just the name of our  
>> project
>> ("Apache UIMA").
>
> I've deployed a SNAPSHOT that adds this.   Change to:
> <resourceBundle>org.apache:apache-jar-resource-bundle:1.1.1- 
> SNAPSHOT</resourceBundle>
>
> and change the properties to:
>                  <properties>
>                      <addLicense>true</addLicense>

			Can you make that projectName to keep the naming convention  
consistent.

>                      <project_name>Apache UIMA</project_name>
>                  </properties>
>
> and that should work.   Eventually, the maven teem will need to get  
> this
> released for you, but I want to hold off a bit to see what other  
> bugs/issues
> will pop up as other projects start using it.   (The whole remote- 
> resources
> thing is very new)
>
>
> -- 
> J. Daniel Kulp
> Principal Engineer
> IONA
> P: 781-902-8727    C: 508-380-7194
> daniel.kulp@iona.com
>
> ---------------------------------------------------------------------
> 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: Trouble adding common resouce files to all jars

Posted by Daniel Kulp <da...@iona.com>.
Adam,

> Thanks, that worked.  However, is there a way to override the name of
> the project that is written to the NOTICES and DISCLAIMER files?
> Currently each jar file uses its own artifact name (e.g. "Apache UIMA
> Java Framework Core") when really we want just the name of our project
> ("Apache UIMA").

I've deployed a SNAPSHOT that adds this.   Change to:
<resourceBundle>org.apache:apache-jar-resource-bundle:1.1.1-SNAPSHOT</resourceBundle>

and change the properties to:
                 <properties>
                     <addLicense>true</addLicense>
                     <project_name>Apache UIMA</project_name>
                 </properties>

and that should work.   Eventually, the maven teem will need to get this 
released for you, but I want to hold off a bit to see what other bugs/issues 
will pop up as other projects start using it.   (The whole remote-resources 
thing is very new)


-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com

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


Re: Trouble adding common resouce files to all jars

Posted by Adam Lally <al...@alum.rpi.edu>.
On 2/15/07, Daniel Kulp <da...@iona.com> wrote:
> Basically, you can add:
> <plugin>
>     <artifactId>maven-remote-resources-plugin</artifactId>
>     <version>1.0-alpha-2-SNAPSHOT</version>
>     <executions>
>         <execution>
>             <goals>
>                 <goal>process</goal>
>             </goals>
>             <configuration>
>                 <resourceBundles>
> <resourceBundle>org.apache:apache-jar-resource-bundle:1.1-SNAPSHOT</resourceBundle>
> <resourceBundle>org.apache:apache-incubator-disclaimer-resource-bundle:1.0</resourceBundle>
>                 </resourceBundles>
>                 <properties>
>                     <addLicense>true</addLicense>
>                 </properties>
>             </configuration>
>         </execution>
>     </executions>
> </plugin>
>

Thanks, that worked.  However, is there a way to override the name of
the project that is written to the NOTICES and DISCLAIMER files?
Currently each jar file uses its own artifact name (e.g. "Apache UIMA
Java Framework Core") when really we want just the name of our project
("Apache UIMA").

-Adam

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


Re: Trouble adding common resouce files to all jars

Posted by Daniel Kulp <da...@iona.com>.
Adam,

On Thursday 15 February 2007 11:36, Adam Lally wrote:
> I am trying to add some common resource files to all of my jars in a
> multimodule project, without having to copy the files to all the
> src/main/resources directories in every single module.  (In particular
> this is for LICENSE and NOTICE files that are required in the jars for
> our Apache incubator project.)

Funny you should mention this.   We working on making this automatic view the 
maven-remote-resources-plugin and the apache-jar-resource-bundle.   There are 
versions available that you could use, but new versions should be going up 
for a vote today that fix a lot of issues. [1]

Basically, you can add:
<plugin>
    <artifactId>maven-remote-resources-plugin</artifactId>
    <version>1.0-alpha-2-SNAPSHOT</version>
    <executions>
        <execution>
            <goals>
                <goal>process</goal>
            </goals>
            <configuration>
                <resourceBundles>
<resourceBundle>org.apache:apache-jar-resource-bundle:1.1-SNAPSHOT</resourceBundle>                    
<resourceBundle>org.apache:apache-incubator-disclaimer-resource-bundle:1.0</resourceBundle>
                </resourceBundles>
                <properties>
                    <addLicense>true</addLicense>
                </properties>
            </configuration>
        </execution>
    </executions>
</plugin>

To your build plugins list and it will automatically add the LICENSE file and 
create a NOTICE file based on your dependencies.   Since UIMA is an incubator 
project, the second resource bundle listed above will add the incubator 
disclaimer as well.   (for right now, you'll need the snapshot repository 
added.   Again, hoping to have releases of the plugin in the next couple 
days.)

This is all fairly new stuff.   If you have problems with it, let us know and 
log bugs at [2].

Dan

[1]http://jira.codehaus.org/secure/ReleaseNote.jspa?version=13180&styleName=Text&projectId=11391&Create=Create
[2]http://jira.codehaus.org/browse/MRRESOURCES



> We tried adding the following to our parent POM (we use the flat layout):
>
>   <build>
>     <resources>
>       <resource>
>         <targetPath>META-INF</targetPath>
>         <filtering>false</filtering>
>         <directory>../uimaj-distr/src/main/readme/</directory>
>         <includes>
>           <include>LICENSE</include>
>           <include>NOTICE</include>
>         </includes>
>       </resource>
>     </resources>
>     ...
>   </build>
>
>
> However this causes _hundreds_ of unit tests to fail when I run "mvn
> clean install".  The surefire-reports contain NoClassDefFoundErrors
> but do not say the name of the class that's not found.
>
> If I remove the <resources> element, everything builds fine.
>
> So far I have not been able to reproduce this in a small test case, so
> I don't know what else might be contributing to the problem.
>
> Any ideas?
>
> Thanks,
>   -Adam
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com

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


Re: Trouble adding common resouce files to all jars

Posted by Daniel Kulp <da...@iona.com>.
Adam,

On Thursday 15 February 2007 11:36, Adam Lally wrote:
> I am trying to add some common resource files to all of my jars in a
> multimodule project, without having to copy the files to all the
> src/main/resources directories in every single module.  (In particular
> this is for LICENSE and NOTICE files that are required in the jars for
> our Apache incubator project.)

Funny you should mention this.   We working on making this automatic view the 
maven-remote-resources-plugin and the apache-jar-resource-bundle.   There are 
versions available that you could use, but new versions should be going up 
for a vote today that fix a lot of issues. [1]

Basically, you can add:
<plugin>
    <artifactId>maven-remote-resources-plugin</artifactId>
    <version>1.0-alpha-2-SNAPSHOT</version>
    <executions>
        <execution>
            <goals>
                <goal>process</goal>
            </goals>
            <configuration>
                <resourceBundles>
<resourceBundle>org.apache:apache-jar-resource-bundle:1.1-SNAPSHOT</resourceBundle>                    
<resourceBundle>org.apache:apache-incubator-disclaimer-resource-bundle:1.0</resourceBundle>
                </resourceBundles>
                <properties>
                    <addLicense>true</addLicense>
                </properties>
            </configuration>
        </execution>
    </executions>
</plugin>

To your build plugins list and it will automatically add the LICENSE file and 
create a NOTICE file based on your dependencies.   Since UIMA is an incubator 
project, the second resource bundle listed above will add the incubator 
disclaimer as well.   (for right now, you'll need the snapshot repository 
added.   Again, hoping to have releases of the plugin in the next couple 
days.)

This is all fairly new stuff.   If you have problems with it, let us know and 
log bugs at [2].

Dan

[1]http://jira.codehaus.org/secure/ReleaseNote.jspa?version=13180&styleName=Text&projectId=11391&Create=Create
[2]http://jira.codehaus.org/browse/MRRESOURCES



> We tried adding the following to our parent POM (we use the flat layout):
>
>   <build>
>     <resources>
>       <resource>
>         <targetPath>META-INF</targetPath>
>         <filtering>false</filtering>
>         <directory>../uimaj-distr/src/main/readme/</directory>
>         <includes>
>           <include>LICENSE</include>
>           <include>NOTICE</include>
>         </includes>
>       </resource>
>     </resources>
>     ...
>   </build>
>
>
> However this causes _hundreds_ of unit tests to fail when I run "mvn
> clean install".  The surefire-reports contain NoClassDefFoundErrors
> but do not say the name of the class that's not found.
>
> If I remove the <resources> element, everything builds fine.
>
> So far I have not been able to reproduce this in a small test case, so
> I don't know what else might be contributing to the problem.
>
> Any ideas?
>
> Thanks,
>   -Adam
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com