Re: Copying dependencies' binaries (dlls) for runtime

2011-01-07 Thread Phillip Hellewell
On Thu, Jan 6, 2011 at 11:27 AM, Phillip Hellewell ssh...@gmail.com wrote:

 Thanks.  Maybe I should take a closer look at NPanday.  But given all
 the other custom logic I need, I'm pretty sure I'll still need my own
 plugin.

For anyone who is curious, this is what I ended up using for my plugin:

1. org.codehaus.plexus.util.xml.pull.XmlPullParser to parse my XML,
similar to how MavenXpp3Reader parses resources.
2. org.codehaus.plexus.util.DirectoryScanner to match files based on
includes/excludes.
3. org.codehaus.plexus.util.FileUtils to copy files and directories

So basically, the Plexus utilities are what I've been looking for my
whole life :)

Phillip

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



Re: Copying dependencies' binaries (dlls) for runtime

2011-01-06 Thread Anders Hammar
Don't put the configuration in a file outside the pom. A plugin's
configuration should be in the pom.

/Anders
On Thu, Jan 6, 2011 at 00:32, Phillip Hellewell ssh...@gmail.com wrote:

 On Wed, Jan 5, 2011 at 4:24 PM, khaido khai...@impinj.com wrote:
 
  You might want to look at the maven-dependency-plugin(
 http://maven.apache.org/plugins/maven-dependency-plugin/).  Nice if you
 also need the transitive dependencies.  Also unpack makes it nice to work
 with zip files.

 Thanks.  I'm actually already using the dependency plugin to copy and
 unpack the dependencies from the local repo to below
 target\dependency.  But now I need to take a subset of those (the dlls
 needed for runtime) and copy them from target\dependency\bin to
 target\bin.

 I'm thinking of writing my own plugin to do the copying, because I
 need some additional logic.  Looking at the mojos in the
 maven-resources-plugin, it looks like I can use shared code from
 org.apache.maven.shared.filtering to do most of the work for me.

 My question now is, if I want to define the resources in a separate
 stand-alone xml file (actually there will be more than one), rather
 than in the pom.xml, what code/class do I use to read an xml file into
 a java.util.List of org.apache.maven.model.Resource?

 Thanks,
 Phillip

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




Re: Copying dependencies' binaries (dlls) for runtime

2011-01-06 Thread Phillip Hellewell
On Wed, Jan 5, 2011 at 8:05 PM, Brett Porter br...@apache.org wrote:
 Resources are for things packaged and to be used at runtime - that doesn't 
 sound like what you want here.

I think maybe it is because I'm talking about just files (like DLLs)
needed for runtime.  Although they don't need to be packaged.

 This is typically done with a combination of the dependecy  assembly plugin.

I'm already using both of these in the appropriate places.  The
assembly plugin packages up my components (which usually include
headers, libs, and dlls), and the dependency plugin unpackages the
dependencies to below target\dependency.

But now I need another step to copy a subset of the files (e.g.,
dlls), from target\dependency\bin to target\bin that are needed for
runtime.  But I can't use the dependency, assembly, or resources
plugin directly because I need additional logic.  So I'm writing my
own plugin and I just need help figuring out the easiest way to have
my own XML file that specifies the filesets and a couple other things.
 After looking at the mojos in the assembly and resources plugin,
patterning my plugin after the resources plugin looks the easiest /
most promising.

 You might also be interested in NPanday 
 (http://incubator.apache.org/npanday/) which provides several .NET specific 
 plugins if that's the flavour of DLL you are dealing with.

Thanks,but at a quick glance it looks like NPanday is more to help
with the build process, and to plug-in to the Visual Studio IDE, so it
doesn't look like it will help me copy DLLs with special logic.

Phillip

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



Re: Copying dependencies' binaries (dlls) for runtime

2011-01-06 Thread Phillip Hellewell
On Thu, Jan 6, 2011 at 1:03 AM, Anders Hammar and...@hammar.net wrote:
 Don't put the configuration in a file outside the pom. A plugin's
 configuration should be in the pom.

The configuration for my plugin will be in the pom of course, but the
configuration of the filesets and other logic to determine some DLLs I
need to copy has to be in separate xml files because they will come
from the dependencies.

I pretty much know what I need to do to write my plugin, and it won't
be that hard, but I'm looking for the best way to have my own xml that
I can easily parse.  And I thought maybe I could re-use the logic the
Maven uses for parsing resources into a java.util.List of
org.apache.maven.model.Resource, so that I can re-use the shared code
in org.apache.maven.shared.filtering to do the actual copying.

Here is a longer description of what I'm trying to do.  I want to
create a plugin that will
1. copy dlls/pdbs/etc needed for runtime from specific places below
target\dependency\bin to target\bin.
2. copy other dlls/pdbs/etc needed for runtime from specific places
defined by XML files that come from the dependencies.

The plugin would take the following params:
sourceDirectory - where dependencies are checked out to (default is
target\dependency)
sourceBinDirectory - where the binary files live (default is
${sourceDirectory}\bin)
sourceXMLDirectory - where the binaries.xml files live (default is
${sourceDirectory}\setup-runtime)
outputDirectory - where to copy binaries to (default is
target\bin\${config}.${platform})
config - (Debug, Release, or all; defaults to all)
platform - (Win32, x64, Any CPU, or all; defaults to all)
framework - (vc100, dotnet35, dotnet40, silverlight4, silverlight5)

The plugin will have a copy-binaries goal that starts by copying all
the dlls/pdbs/etc that exist in the standard locations to the
outputDirectory:
1. $sourceBinDirectory/$framework/$config.$platform/*
2. $sourceBinDirectory/$framework/$config for $platform.*/
3. $sourceBinDirectory/$framework/$config/*
4. $sourceBinDirectory/$framework/$platform/* (look for d extension
to exclude debug or release depending on config)

The copy-binaries goal will then copy non-standard files (outside
$sourceBinDirectory) by looking for fileset definitions in files named
binaries.xml below $sourceXMLDirectory.  The components that need to
will provide this binaries.xml.

Example binaries.xml file, assuming I mimic the XML schema used by the
assembly plugin (directory is relative to ${sourceDirectory}):
?xml version=1.0 encoding=utf-8?
binaries
  fileSets
!-- Copy all tz files --
fileSet
  includes
includetz/**/include
  /includes
/fileSet
!-- Copy dtSearch 32-bit files if platform is Win32 --
fileSet
  platformWin32/platform
  directorydtSearch\bin\32bit/directory
  includes
include**/include
  /includes
/fileSet
  /fileSets
/binaries

If I pattern after the resources plugin, and can re-use some of that
logic, then the tags will probably be resources and resource
instead of fileSets and fileSet.

Phillip

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



Re: Copying dependencies' binaries (dlls) for runtime

2011-01-06 Thread Wendy Smoak
On Thu, Jan 6, 2011 at 11:56 AM, Phillip Hellewell ssh...@gmail.com wrote:
 You might also be interested in NPanday 
 (http://incubator.apache.org/npanday/) which provides several .NET specific 
 plugins if that's the flavour of DLL you are dealing with.

 Thanks,but at a quick glance it looks like NPanday is more to help
 with the build process, and to plug-in to the Visual Studio IDE, so it
 doesn't look like it will help me copy DLLs with special logic.

With NPanday, you can treat DLLs like normal dependencies.  NPanday
copies them 'where you need them' automatically.

(Though I'm a bit unsure about what you mean by 'runtime' in your
original question.)

-- 
Wendy

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



Re: Copying dependencies' binaries (dlls) for runtime

2011-01-06 Thread Phillip Hellewell
On Thu, Jan 6, 2011 at 11:06 AM, Wendy Smoak wsm...@gmail.com wrote:
 On Thu, Jan 6, 2011 at 11:56 AM, Phillip Hellewell ssh...@gmail.com wrote:
 You might also be interested in NPanday 
 (http://incubator.apache.org/npanday/) which provides several .NET specific 
 plugins if that's the flavour of DLL you are dealing with.

 Thanks,but at a quick glance it looks like NPanday is more to help
 with the build process, and to plug-in to the Visual Studio IDE, so it
 doesn't look like it will help me copy DLLs with special logic.

 With NPanday, you can treat DLLs like normal dependencies.  NPanday
 copies them 'where you need them' automatically.

Thanks.  Maybe I should take a closer look at NPanday.  But given all
the other custom logic I need, I'm pretty sure I'll still need my own
plugin.

So, can anyone answer my actual question of would it work to take an
xml with just a resources tag in it, surround it with
projectbuild   /build/project or whatever to make it a valid
pom, and then use the MavenXpp3Reader to parse that?  Or would it be
better to copy and modify the code I found in parseResource() function
in MavenXpp3Reader?

Another idea is to write an .mdo file, based on the one in the
assembly plugin, and use the modello plugin to generate the Java I
need to parse my xml, but that seems like it might be more work than
just copying the parseResource() function from MavenXpp3Reader.

Phillip

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



RE: Copying dependencies' binaries (dlls) for runtime

2011-01-05 Thread khaido

You might want to look at the 
maven-dependency-plugin(http://maven.apache.org/plugins/maven-dependency-plugin/).
  Nice if you also need the transitive dependencies.  Also unpack makes it nice 
to work with zip files.



From: Phillip Hellewell [via Maven] 
[mailto:ml-node+3329689-622232288-147...@n5.nabble.com]
Sent: Wednesday, January 05, 2011 2:52 PM
To: Khai Do
Subject: Copying dependencies' binaries (dlls) for runtime

Is it appropriate / best practice to use the maven-resources-plugin to
copy dlls from target\dependency\bin to target\bin so they will be
where I need them for runtime?

Thanks,
Phillip

-
To unsubscribe, e-mail: [hidden 
email]/user/SendEmail.jtp?type=nodenode=3329689i=0
For additional commands, e-mail: [hidden 
email]/user/SendEmail.jtp?type=nodenode=3329689i=1



View message @ 
http://maven.40175.n5.nabble.com/Copying-dependencies-binaries-dlls-for-runtime-tp3329689p3329689.html
To start a new topic under Maven - Users, email 
ml-node+40176-907978382-147...@n5.nabble.com
To unsubscribe from Maven - Users, click 
herehttp://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=40176code=a2hhaS5kb0BpbXBpbmouY29tfDQwMTc2fC0xMjUwNjg2MDQ0.

-- 
View this message in context: 
http://maven.40175.n5.nabble.com/Copying-dependencies-binaries-dlls-for-runtime-tp3329689p3329746.html
Sent from the Maven - Users mailing list archive at Nabble.com.


Re: Copying dependencies' binaries (dlls) for runtime

2011-01-05 Thread Phillip Hellewell
On Wed, Jan 5, 2011 at 4:24 PM, khaido khai...@impinj.com wrote:

 You might want to look at the 
 maven-dependency-plugin(http://maven.apache.org/plugins/maven-dependency-plugin/).
   Nice if you also need the transitive dependencies.  Also unpack makes it 
 nice to work with zip files.

Thanks.  I'm actually already using the dependency plugin to copy and
unpack the dependencies from the local repo to below
target\dependency.  But now I need to take a subset of those (the dlls
needed for runtime) and copy them from target\dependency\bin to
target\bin.

I'm thinking of writing my own plugin to do the copying, because I
need some additional logic.  Looking at the mojos in the
maven-resources-plugin, it looks like I can use shared code from
org.apache.maven.shared.filtering to do most of the work for me.

My question now is, if I want to define the resources in a separate
stand-alone xml file (actually there will be more than one), rather
than in the pom.xml, what code/class do I use to read an xml file into
a java.util.List of org.apache.maven.model.Resource?

Thanks,
Phillip

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



Re: Copying dependencies' binaries (dlls) for runtime

2011-01-05 Thread Phillip Hellewell
On Wed, Jan 5, 2011 at 4:32 PM, Phillip Hellewell ssh...@gmail.com wrote:

 My question now is, if I want to define the resources in a separate
 stand-alone xml file (actually there will be more than one), rather
 than in the pom.xml, what code/class do I use to read an xml file into
 a java.util.List of org.apache.maven.model.Resource?

Would it work to take read the resources tag from my XML, surround
it with projectbuild   /build/project or whatever to make it a
valid pom, and then use the MavenXpp3Reader to parse that?

I think I found the code where it parses a Resource, and obviously I
don't want to duplicate that code in my own plugin:

http://maven.apache.org/ref/2.0.11/xref/org/apache/maven/model/io/xpp3/MavenXpp3Reader.html#4474

Phillip

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



Re: Copying dependencies' binaries (dlls) for runtime

2011-01-05 Thread Brett Porter
Resources are for things packaged and to be used at runtime - that doesn't 
sound like what you want here.

This is typically done with a combination of the dependecy  assembly plugin.

You might also be interested in NPanday (http://incubator.apache.org/npanday/) 
which provides several .NET specific plugins if that's the flavour of DLL you 
are dealing with.

- Brett

On 06/01/2011, at 11:22 AM, Phillip Hellewell wrote:

 On Wed, Jan 5, 2011 at 4:32 PM, Phillip Hellewell ssh...@gmail.com wrote:
 
 My question now is, if I want to define the resources in a separate
 stand-alone xml file (actually there will be more than one), rather
 than in the pom.xml, what code/class do I use to read an xml file into
 a java.util.List of org.apache.maven.model.Resource?
 
 Would it work to take read the resources tag from my XML, surround
 it with projectbuild   /build/project or whatever to make it a
 valid pom, and then use the MavenXpp3Reader to parse that?
 
 I think I found the code where it parses a Resource, and obviously I
 don't want to duplicate that code in my own plugin:
 
 http://maven.apache.org/ref/2.0.11/xref/org/apache/maven/model/io/xpp3/MavenXpp3Reader.html#4474
 
 Phillip
 
 -
 To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
 For additional commands, e-mail: users-h...@maven.apache.org
 

--
Brett Porter
br...@apache.org
http://brettporter.wordpress.com/
http://au.linkedin.com/in/brettporter





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