You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Fiona Mahon <fm...@tssg.org> on 2009/06/19 12:22:48 UTC

Dependency-copy:exclude & includeScope behaviour

Hi,

I am using the dependency plugin for maven to copy an artifact and its 
dependencies to a particular folder, that causes the generated artifact 
to be automatically started in a container (an OSGi container in this 
instance).

Without specifying any include/excludeScope parameters, all dependent 
components for my artifact are getting copied over, including the ones I 
have already packaged in with the artifact during compile (as those 
dependencies are defined as 'compile').

My artifact has 2 kinds of dependencies, the ones that are resolved 
during compile and added into the artifact jar, and the ones that will 
be available (provided) at runtime inside the container.

What I want to be able to do is only copy the dependencies that are to 
be provided in the container, to the container folder along with my 
artifact, but not copy the dependencies I have already taken care of by 
including them inside the artifact jar already (i.e. using compile scope).

What I tried was to exclude the compile scope dependencies and include 
the provided dependencies (see below), but what actually happened when I 
did this was that I get all the dependencies copied, both compile and 
provided.



<plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <executions>
                      <execution>
                            <id>copy</id>
                        <phase>install</phase>
                            <goals>
                              <goal>copy</goal>
                        </goals>
                      </execution>
                      <execution>
                        <id>copy-dependencies</id>
                        <phase>install</phase>
                        <goals>
                              <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                               <excludeScope>compile</excludeScope>
                               <includeScope>provided</includeScope>
                          </configuration>
                    </execution>
                      
                    </executions>
                    <configuration>
                          <overWriteReleases>true</overWriteReleases>
                          <overWriteSnapshots>true</overWriteSnapshots>
                          <stripVersion>true</stripVersion>
                          <!-- this is where your dependent bundles will 
go e.g. junit, log4j etc. -->
                          
<outputDirectory>${kf.pssdependencies.deploy.dir}</outputDirectory>
                    </configuration>
                  </plugin>


I also tried to just exclude the compile scope, but this time I just get 
the test dependencies copied over. I know there is some kind of 
hierarchy of scopes but I haven't see anything anywhere explaining this.

I did see a post explaining how the code works:

public ScopeArtifactFilter( String scope )
{
if ( DefaultArtifact.SCOPE_COMPILE.equals( scope ) )

{ systemScope = true; providedScope = true; compileScope = true; 
runtimeScope = false; testScope = false; }

else if ( DefaultArtifact.SCOPE_RUNTIME.equals( scope ) )

{ systemScope = false; providedScope = false; compileScope = true; 
runtimeScope = true; testScope = false; }

else if ( DefaultArtifact.SCOPE_TEST.equals( scope ) )

{ systemScope = true; providedScope = true; compileScope = true; 
runtimeScope = true; testScope = true; }

else

{ systemScope = false; providedScope = false; compileScope = false; 
runtimeScope = false; testScope = false; }

}

However, what I really want is

SystemScope = true; providedScope = true; compileScope = false; 
runtimeScope = false; testScope = false;

which doesn't seem to be accounted for.

Any help would be great, even a scope hierarchy.

Thanks,
Fiona.


-- 
Fiona Mahon
Pervasive Communication Services(PCS),
Applied Research

Telecommunications Software & Systems Group (TSSG),
ArcLabs Research and Innovation Building,
Waterford Institute of Technology,
Carriganore Campus, Carriganore,
Co. Waterford, Ireland
	
www: www.tssg.org/people/fmahon
tel: +353 (0)51 302 928   
fax: +353 (0)51 341 100  
e-mail: fmahon@tssg.org
Skype: fiona_mahon




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


RE: Dependency-copy:exclude & includeScope behaviour

Posted by Mohan KR <km...@gmail.com>.
I believe you need to have *two* executions of copy-dependencies goal with
in one case:
 <includeScope>provided</includeScope>
in the second case:
 <includeScope>system</includeScope>

Don't put the excludeScope element.

Thanks,
mohan kr

-----Original Message-----
From: Fiona Mahon [mailto:fmahon@tssg.org] 
Sent: Friday, June 19, 2009 5:23 AM
To: users@maven.apache.org
Subject: Dependency-copy:exclude & includeScope behaviour

Hi,

I am using the dependency plugin for maven to copy an artifact and its 
dependencies to a particular folder, that causes the generated artifact 
to be automatically started in a container (an OSGi container in this 
instance).

Without specifying any include/excludeScope parameters, all dependent 
components for my artifact are getting copied over, including the ones I 
have already packaged in with the artifact during compile (as those 
dependencies are defined as 'compile').

My artifact has 2 kinds of dependencies, the ones that are resolved 
during compile and added into the artifact jar, and the ones that will 
be available (provided) at runtime inside the container.

What I want to be able to do is only copy the dependencies that are to 
be provided in the container, to the container folder along with my 
artifact, but not copy the dependencies I have already taken care of by 
including them inside the artifact jar already (i.e. using compile scope).

What I tried was to exclude the compile scope dependencies and include 
the provided dependencies (see below), but what actually happened when I 
did this was that I get all the dependencies copied, both compile and 
provided.



<plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <executions>
                      <execution>
                            <id>copy</id>
                        <phase>install</phase>
                            <goals>
                              <goal>copy</goal>
                        </goals>
                      </execution>
                      <execution>
                        <id>copy-dependencies</id>
                        <phase>install</phase>
                        <goals>
                              <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                               <excludeScope>compile</excludeScope>
                               <includeScope>provided</includeScope>
                          </configuration>
                    </execution>
                      
                    </executions>
                    <configuration>
                          <overWriteReleases>true</overWriteReleases>
                          <overWriteSnapshots>true</overWriteSnapshots>
                          <stripVersion>true</stripVersion>
                          <!-- this is where your dependent bundles will 
go e.g. junit, log4j etc. -->
                          
<outputDirectory>${kf.pssdependencies.deploy.dir}</outputDirectory>
                    </configuration>
                  </plugin>


I also tried to just exclude the compile scope, but this time I just get 
the test dependencies copied over. I know there is some kind of 
hierarchy of scopes but I haven't see anything anywhere explaining this.

I did see a post explaining how the code works:

public ScopeArtifactFilter( String scope )
{
if ( DefaultArtifact.SCOPE_COMPILE.equals( scope ) )

{ systemScope = true; providedScope = true; compileScope = true; 
runtimeScope = false; testScope = false; }

else if ( DefaultArtifact.SCOPE_RUNTIME.equals( scope ) )

{ systemScope = false; providedScope = false; compileScope = true; 
runtimeScope = true; testScope = false; }

else if ( DefaultArtifact.SCOPE_TEST.equals( scope ) )

{ systemScope = true; providedScope = true; compileScope = true; 
runtimeScope = true; testScope = true; }

else

{ systemScope = false; providedScope = false; compileScope = false; 
runtimeScope = false; testScope = false; }

}

However, what I really want is

SystemScope = true; providedScope = true; compileScope = false; 
runtimeScope = false; testScope = false;

which doesn't seem to be accounted for.

Any help would be great, even a scope hierarchy.

Thanks,
Fiona.


-- 
Fiona Mahon
Pervasive Communication Services(PCS),
Applied Research

Telecommunications Software & Systems Group (TSSG),
ArcLabs Research and Innovation Building,
Waterford Institute of Technology,
Carriganore Campus, Carriganore,
Co. Waterford, Ireland
	
www: www.tssg.org/people/fmahon
tel: +353 (0)51 302 928   
fax: +353 (0)51 341 100  
e-mail: fmahon@tssg.org
Skype: fiona_mahon




---------------------------------------------------------------------
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