When I run "mvn dependency:tree" for my project it shows the following:
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # xxxxx ---
[INFO] com.xxx.xxx:xxxxx:war:3.1.0-SNAPSHOT
...
[INFO] +- commons-configuration:commons-configuration:jar:1.5:compile
[INFO] | \- commons-beanutils:commons-beanutils-core:jar:1.7.0:compile
[INFO] +- org.seleniumhq.selenium:selenium-api:jar:2.34.0:test
[INFO] | +- com.google.guava:guava:jar:14.0:test
[INFO] | \- org.json:json:jar:20080701:test
[INFO] +- org.seleniumhq.selenium:selenium-htmlunit-driver:jar:2.34.0:test
[INFO] | +- org.seleniumhq.selenium:selenium-remote-driver:jar:2.34.0:test
[INFO] | | +- cglib:cglib-nodep:jar:2.1_3:test
[INFO] | | +- net.java.dev.jna:jna:jar:3.4.0:test
[INFO] | | \- net.java.dev.jna:platform:jar:3.4.0:test
[INFO] | \- net.sourceforge.htmlunit:htmlunit:jar:2.12:test
[INFO] | +- org.apache.commons:commons-lang3:jar:3.1:test
[INFO] | +- org.apache.httpcomponents:httpmime:jar:4.2.3:test
[INFO] | +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.12:test
[INFO] | +- xerces:xercesImpl:jar:2.10.0:test
>>>[INFO] | | \- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] | +- net.sourceforge.nekohtml:nekohtml:jar:1.9.18:test
[INFO] | +- net.sourceforge.cssparser:cssparser:jar:0.9.9:test
[INFO] | | \- org.w3c.css:sac:jar:1.3:test
[INFO] | \- org.eclipse.jetty:jetty-websocket:jar:8.1.9.v20130131:test
[INFO] +- org.seleniumhq.selenium:selenium-firefox-driver:jar:2.34.0:test
...
As you see on the marked line, the xml-apis has "compile" scope, and as result it is packed into .war file. Why could it happen?
More interestingly it happens only while Java5 is used, for Java6 the dependency appears as "test".
Maven version: 3.0.4
Study the output of the following Maven command.
mvn -X dependency:tree -Dverbose
That should tell you why Maven upgraded the scope from test to compile.
If you take a look at xercesImpl it contains a dependency to xml-apis:xml-apis:jar:1.4.01:compile with the scope compile so the display of dependency plugin is correct. The usage of -Dverbose will do things as written in the docs:
Whether to include omitted nodes in the serialized dependency tree.
Apart from the above a test dependency as in your case is never being packaged into a war file.
There must be an other source of the same dependency which causes the packaging into the war
Furthermore the change in behaviour in relationship with adding explicit xml-apis to your pom is a supplemental evidence for this.
I had a similar problem.
In my case an entry in the dependencyManagement of a parent pom set the scope of the dependent artefact to compile. Actually I omitted the scope tag which effectively is the same as setting it to compile. Changing it to provided helped.
Seems the scope in dependencyManagement takes precedence over the transitive scope. Which makes sense but can still cause confusion when all you wanted to do is define the version.
It was actually not hard to spot: Looking at the effective-pom showed the dependencyManagement entry.
Related
Title says it all. Given a dependency, how can I get a tree of its dependencies?
Let's say I want to target org.hibernate:hibernate-core:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.24.Final</version>
</dependency>
As a result I want:
[INFO] | \- org.hibernate:hibernate-core:jar:5.4.24.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.4.1.Final:compile
[INFO] | +- javax.persistence:javax.persistence-api:jar:2.2:compile
[INFO] | +- net.bytebuddy:byte-buddy:jar:1.10.17:compile
[INFO] | +- antlr:antlr:jar:2.7.7:compile
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.1.1.Final:compile
[INFO] | +- org.jboss:jandex:jar:2.1.3.Final:compile
[INFO] | +- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] | +- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] | +- org.dom4j:dom4j:jar:2.1.3:compile
[INFO] | \- org.hibernate.common:hibernate-commons-annotations:jar:5.1.2.Final:compile
I tried:
mvn dependency:tree -DgroupId=org.hibernate -DartifactId=hibernate-core -Dversion=5.4.24.Final
But It does not work.
:tree or :list does not matter. All I want is the dependencies of a dependency in my project.
If I mvn dependency:tree -Dincludes=org.hibernate:hibernate-core I get:
[INFO] \- org.hibernate:hibernate-core:jar:5.4.24.Final:compile
and its dependencies are missing.
There is this online "tool" that does exactly what I want. Is it possible to do it with a mvn command?
What you get is expected.
When using the includes user property such as : -Dincludes=org.hibernate:hibernate-core, the output shows the org.hibernate:hibernate-core dependency along the dependency(ies) that pulled that one.
You want the reverse : displaying the dependencies pulled by org.hibernate:hibernate-core.
To achieve that : you need to execute mvn dependency:tree since the org.hibernate:hibernate-core POM.
So You should go with your shell into your local repository and execute that command.
But that is an hassle : IDE Plugins for Maven provided by Eclipse and IntelliJ do that very well.
Example with m2e Eclipse plugin.
On the m2 view of your pom.xml, double click on the dependency that you want to develop.
And that is done :
A Maven way alternative if suitable would be using the dependency:copy goal by specifying pom as classifier :
#retrieve and store the hibernate pom
mvn dependency:copy -Dartifact=org.hibernate:hibernate-core:5.2.14.final:pom
#see the dependencty tree on the hibernate pom
mvn -f target/dependency/hibernate-core-5.2.14.final.pom dependency:tree
Two notes :
it will work even if the artifact is in your local repository (the artifact is first installed in that case).
you can specify the current directory as output directory instead of the default path that is target/dependency with the -DoutputDirectory=. flag.
I have two projects that use identical pom files (one project is an earlier version of the second). The second project compiles fine and allows me to use all the dependencies defined in the pom in my project. However the first project does not, and it appears as though the dependencies are not even recognized by the project.
I looked in my local .m2 folder and see that the dependencies have been downloaded in their respective folders. I even see the mvn install output says it has included the dependency, e.g.:
Including com.fasterxml.jackson.core:jackson-core:jar:2.9.6 in the shaded jar.
And later...
com.fasterxml.jackson.core:jackson-databind:jar:2.9.6 already exists in destination.
I've tried mvn clean and the dependency is still not recognized. I've tried examining the contents of all of the pom files in the project and I can't see any difference between the two projects.
I'm convinced that there is something wrong with my project, but I'm not a maven expert. Any ideas of where to look for the problem?
Here's an example of one of the dependencies that is not recognized:
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.4</version>
<scope>compile</scope>
</dependency>
Here is my mvn dependency:tree ouput
[INFO] SwirldsProxy:SwirldsProxy:jar:0.0.1-SNAPSHOT
[INFO] +- SwirldsPlatform:platform:jar:0.0.1-SNAPSHOT:compile
[INFO] | +- SwirldsPlatform:fc:jar:0.0.1-SNAPSHOT:compile
[INFO] | | +- SwirldsPlatform:fcfs:jar:0.0.1-SNAPSHOT:compile
[INFO] | | | +- SwirldsPlatform:fcutil:jar:0.0.1-SNAPSHOT:compile
[INFO] | | | | +- SwirldsPlatform:abcl-swirlds:jar:0.0.1-SNAPSHOT:compile
[INFO] | | | | +- org.abcl:abcl-contrib:jar:1.4.0:compile
[INFO] | | | | +- org.apache.derby:derby:jar:10.12.1.1:compile
[INFO] | | | | \- org.beanshell:bsh:jar:2.0b5:compile
[INFO] | | | \- SwirldsPlatform:fcfs-dep-fasl:jar:0.0.1-SNAPSHOT:compile
[INFO] | | +- SwirldsPlatform:fcdb:jar:0.0.1-SNAPSHOT:compile
[INFO] | | | \- SwirldsPlatform:fcdb-dep-fasl:jar:0.0.1-SNAPSHOT:compile
[INFO] | | \- junit:junit:jar:3.8.2:compile
[INFO] | +- com.offbynull.portmapper:portmapper:jar:2.0.4:compile
[INFO] | | +- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] | | +- commons-io:commons-io:jar:2.5:compile
[INFO] | | \- org.apache.commons:commons-collections4:jar:4.1:compile
[INFO] | +- org.slf4j:slf4j-nop:jar:1.7.21:compile
[INFO] | +- org.apache.logging.log4j:log4j-api:jar:2.7:compile
[INFO] | \- org.apache.logging.log4j:log4j-core:jar:2.7:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.6:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.9.6:compile
[INFO] +- com.google.code.gson:gson:jar:2.4:compile
[INFO] +- com.rabbitmq:amqp-client:jar:4.0.2:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.21:compile
[INFO] \- com.github.davidmoten:flatbuffers-java:jar:1.6.0.2:compile
Apache Maven 3.5.0 Maven
Java version: 1.8.0_144-1-redhat
UPDATE 8/30/2018
So I discovered some interseting behavior. My project location was under D:\SomeDirectory. I tried moving it to C:\AnotherDirectory and performed mvn install and bingo, the dependencies were now available to my project.
I'm assuming this has something to do with the maven/java installation location, however I find it strange that I saw no errors when trying to run the maven commands, even when the project was under a different root directory (D:) compared to maven/java (C:).
Any ideas?
I am trying to enable printing debugging information for a maven project. I added log4j as dependency to pom.xml and added log4j.properties as well as log4j2.properties with rootloger=DEBUG, sdout to src/main/resources folder. Then in the desired class, I initiate a logger in the desired class 'org.pakage1.ClassA' and add logger.debug() lines but nothing was shown in my consul. When I checked logger.isDebugEnabled() it returns false
pom.xml
<dependencies>
.....
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
</dependency>
log4j.properties and similarly log4j2
log4j.debug=true
log4j.rootLogger=DEBUG, stdout
log4j.appender.Stdout.threshold=debug
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%-5p %d [%t] %c{1} - %m%n
and as extra step I tried adding
log4j.logger.extendedsldnf.ExtendedSLDNFEvaluator=DEBUG
but it also did not work.
package package1;
......
class ClassA{
private Logger logger = LoggerFactory.getLogger(getClass());
......
public static void main(String []args){
logger.debug("message");
}
}
Knowing that I am getting warning
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
Also the project has other sub-modules that also have logging enabled similarly and debugging messages works well when stated in the log4j.properties file
Is there something missing? How to check if there is something conflicting?
added log4j.properties as well as log4j2.properties
The first one is for log4j 1, the second one is for log4j 2.
Declaring both is not a way to solve your problem.
Use only which one that matches to your actual log4j version.
SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Actual
binding is of type
[ch.qos.logback.classic.util.ContextSelectorStaticBinder]
Indeed, the problem is rather clear : you want to use the log4J implementation as SLF4J binding but you have at runtime in the classpath at least one another SLF4J binding. Here is mentioned ContextSelectorStaticBinder from Logback that is another binding.
You have to have in the classpath at runtime a single implementation/binding for SLF4J.
To solve your problem, it is rather simple.
As you use Maven, I propose you to execute the mvn dependency:tree command from the agreggator pom of your application or if you have not agreggator pom, from the pom that packages your application.
This command will write as output the dependencies (including transitive dependencies pulled by your pom).
It will output something like that :
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) # Test-Spring-Boot ---
[INFO] Test-Spring-Boot:Test-Spring-Boot:jar:0.0.1-SNAPSHOT
[INFO] \- org.springframework.boot:spring-boot-starter-web:jar:1.4.4.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter:jar:1.4.4.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot:jar:1.4.4.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.4.4.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-logging:jar:1.4.4.RELEASE:compile
[INFO] | | +- ch.qos.logback:logback-classic:jar:1.1.9:compile
[INFO] | | | +- ch.qos.logback:logback-core:jar:1.1.9:compile
[INFO] | | | \- org.slf4j:slf4j-api:jar:1.7.22:compile
[INFO] | | +- org.slf4j:jcl-over-slf4j:jar:1.7.22:compile
[INFO] | | +- org.slf4j:jul-to-slf4j:jar:1.7.22:compile
[INFO] | | \- org.slf4j:log4j-over-slf4j:jar:1.7.22:compile
[INFO] | +- org.springframework:spring-core:jar:4.3.6.RELEASE:compile
[INFO] | \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.4.4.RELEASE:compile
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.11:compile
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.11:compile
[INFO] | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.11:compile
[INFO] +- org.hibernate:hibernate-validator:jar:5.2.4.Final:compile
[INFO] | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] | \- com.fasterxml:classmate:jar:1.3.3:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.6:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.6:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.8.6:compile
[INFO] +- org.springframework:spring-web:jar:4.3.6.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:4.3.6.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:4.3.6.RELEASE:compile
[INFO] | \- org.springframework:spring-context:jar:4.3.6.RELEASE:compile
[INFO] \- org.springframework:spring-webmvc:jar:4.3.6.RELEASE:compile
[INFO] \- org.springframework:spring-expression:jar:4.3.6.RELEASE:compile
You have just to identify from where the logback dependency is pulled.
Once having identified it, remove the dependency it if it is an dependency explicitly declared from our own pom.
If it is a transitive dependency, use the exclusion dependency mechanism of Maven.
If you want to use log4j appender to print slf4j logger's log, make sure that you have slf4j-log4j12 jar and remove logback jars, or it will be out of your control whether log4j or logback in use.
I don't understand how to load CoreNLP's Shift-Reduce Constituency Parser (SRCP) from my java app.
I'm using Apache Maven to manage my project's dependencies. Per the docs, the SRCP model is not bundled with CoreNLP, so I have downloaded stanford-srparser-2014-10-23-models.jar separately (http://nlp.stanford.edu/software/srparser.shtml) and placed that file in:
~/.m2/repository/edu/stanford/nlp/stanford-corenlp/3.5.2/stanford-srparser-2014-10-23-models.jar
That is the same directory as the core dependency jar
~/.m2/repository/edu/stanford/nlp/stanford-corenlp/3.5.2/stanford-corenlp-3.5.2.jar
Here is the relevant portion of my project's pom.xml:
<dependency>
<groupId>edu.stanford.nlp</groupId>
<artifactId>stanford-corenlp</artifactId>
<version>3.5.2</version>
</dependency>
<dependency>
<groupId>edu.stanford.nlp</groupId>
<artifactId>stanford-corenlp</artifactId>
<version>3.5.2</version>
<classifier>models</classifier>
</dependency>
Compiling is successful:
mvn clean compile
But when I try to load the app, I receive:
java.lang.reflect.InvocationTargetException
...
Caused by: edu.stanford.nlp.io.RuntimeIOException: java.io.IOException: Unable to resolve "edu/stanford/nlp/models/srparser/englishSR.ser.gz" as either class path, filename or URL
I unzipped the compiled project war, and "edu/stanford/nlp/models/srparser/englishSR.ser.gz" is not present.
Here is how I'm calling the model in my app:
// Initialize a CoreNLP pipeline
public static Properties props = new Properties();
public static StanfordCoreNLP pipeline;
// Set the CoreNLP pipeline annotators.
props.setProperty("annotators", "tokenize, ssplit, parse, sentiment");
props.setProperty("parse.model", "edu/stanford/nlp/models/srparser/englishSR.ser.gz");
pipeline = new StanfordCoreNLP(props);
How can I update my Maven config to force my CoreNLP dependency to include the srparser model? Keep in mind that I need this configuration to run in other developers' environments, so the solution should be clean and reusable if possible.
Thanks!
EDIT:
In response to #jah's comment, below are the results of mvn dependency:tree. The build succeeds, but the srparser model is not compiled/present:
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # [REDACTED] ---
Downloading:
...
[INFO] com.[REDACTED].nlp:nlp:war:0.1.0
[INFO] +- com.strategicgains:RestExpress:jar:0.11.2:compile
[INFO] | +- com.strategicgains:RestExpress-Common:jar:0.11.2:compile
[INFO] | +- com.strategicgains:DateAdapterJ:jar:1.1.4:compile
[INFO] | +- com.thoughtworks.xstream:xstream:jar:1.4.7:compile
[INFO] | | +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] | | \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] | +- io.netty:netty-all:jar:4.0.29.Final:compile
[INFO] | +- org.owasp.encoder:encoder:jar:1.1.1:compile
[INFO] | \- com.jcraft:jzlib:jar:1.1.3:compile
[INFO] +- junit:junit:jar:4.11:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- edu.stanford.nlp:stanford-corenlp:jar:3.5.2:compile
[INFO] | +- com.io7m.xom:xom:jar:1.2.10:compile
[INFO] | | +- xml-apis:xml-apis:jar:1.3.03:compile
[INFO] | | +- xerces:xercesImpl:jar:2.8.0:compile
[INFO] | | \- xalan:xalan:jar:2.7.0:compile
[INFO] | +- joda-time:joda-time:jar:2.1:compile
[INFO] | +- de.jollyday:jollyday:jar:0.4.7:compile
[INFO] | | \- javax.xml.bind:jaxb-api:jar:2.2.7:compile
[INFO] | +- com.googlecode.efficient-java-matrix-library:ejml:jar:0.23:compile
[INFO] | \- javax.json:javax.json-api:jar:1.0:compile
[INFO] +- edu.stanford.nlp:stanford-corenlp:jar:models:3.5.2:compile
[INFO] +- org.json:json:jar:20151123:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.6.4:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.6.0:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.6.4:compile
[INFO] \- commons-io:commons-io:jar:1.3.2:compile
First, download the srparser jar and place it in your project root: http://nlp.stanford.edu/software/stanford-srparser-2014-10-23-models.jar
Second, from the project root, execute the following command to install the srparser model dependency via Maven:
mvn install:install-file -Dfile=stanford-srparser-2014-10-23-models.jar -DgroupId=edu.stanford.nlp -DartifactId=stanford-srparser -Dversion=3.5.2 -Dpackaging=jar
Note the custom artifactId and lack of classifier in the command -- this is to prevent namespace confusion with the other CoreNLP modules.
Third, add the dependency to the Maven project's pom.xml:
<dependencies>
...
<dependency>
<groupId>edu.stanford.nlp</groupId>
<artifactId>stanford-srparser</artifactId>
<version>3.5.2</version>
</dependency>
...
</dependencies>
Finally, clean install:
mvn clean install
If you continue to experience issues, it may be helpful to clear your Maven dependencies:
mvn dependency:purge-local-repository
And don't forget to add the download/install commands to your project README/environment bootstrap file!
(Thanks for your help #jah and #GaborAngeli.)
To run the shift-reduce parser, you need to include the shift-reduce models jar, which can be found at: http://nlp.stanford.edu/software/srparser.shtml
Not sure if it's on maven, but it appears not?
If you run the mvn command from the folder where the stanford-srparser-2014-10-23-models.jar is placed, then the following command should do the trick.
mvn install:install-file -Dfile=stanford-srparser-2014-10-23-models.jar -DgroupId=edu.stanford.nlp -DartifactId=stanford-corenlp -Dversion=3.5.2 -Dclassifier=models -Dpackaging=jar
I'm building a Java Project MaterialsDep that is a plugin for project craftbukkit [loaded in my workspace and a direct dependency of MaterialsDep of type jar and scope compile]. Looking at MaterialsDep's pom's dependency hierarchy in eclipse all jars needed by CB show up as resolved and listed correctly. However running mvn dependency:copy-dependencies on project AP only copies direct dependencies and nothing else.
Running dependency:tree shows:
[INFO] --- maven-dependency-plugin:2.4:tree (default-cli) # MaterialsDep ---
[INFO] MaterialsDep:MaterialsDep:jar:0.0.1-SNAPSHOT
[INFO] +- org.bukkit:craftbukkit:jar:1.3.1-R1.1-SNAPSHOT:compile
[INFO] +- org.pircbotx:pircbotx:jar:1.7:compile
[INFO] \- org.bukkit:bukkit:jar:1.3.1-R1.1-SNAPSHOT:compile
which are the direct dependencies.
How should I go about ensuring that craftbukkit's dependency are recognized and copied ?
[EDIT]
dependency:tree for craftbukkit:
[INFO] org.bukkit:craftbukkit:jar:1.3.1-R1.1-SNAPSHOT
[INFO] +- org.bukkit:bukkit:jar:1.3.1-R1.1-SNAPSHOT:compile
[INFO] +- org.bukkit:minecraft-server:jar:1.3.1:compile
[INFO] +- net.sf.jopt-simple:jopt-simple:jar:3.2:compile
[INFO] +- jline:jline:jar:2.6:compile
[INFO] +- org.fusesource.jansi:jansi:jar:1.8:compile
[INFO] +- org.xerial:sqlite-jdbc:jar:3.7.2:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.14:compile
[INFO] +- org.avaje:ebean:jar:2.7.3:provided
[INFO] | \- javax.persistence:persistence-api:jar:1.0:provided
[INFO] +- org.yaml:snakeyaml:jar:1.9:provided
[INFO] +- com.google.guava:guava:jar:10.0:provided
[INFO] | \- com.google.code.findbugs:jsr305:jar:1.3.9:provided
[INFO] +- commons-lang:commons-lang:jar:2.3:provided
[INFO] +- junit:junit-dep:jar:4.10:test
[INFO] +- org.hamcrest:hamcrest-library:jar:1.2.1:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.2.1:test
[INFO] \- com.google.code.gson:gson:jar:2.1:compile
By configuring the dependency plugin correctly. The property excludeTransitive defines whether transitive dependencies will be ignored or not. Make sure it's value is false.
mvn help:effective-pom might help to find out how the plugin is configured.
[EDIT] copy-dependencies will only copy what dependency:tree shows. As you can see in the output above, craftbukkit itself doesn't have any further dependencies. My guess is that all dependencies in craftbukkit's POM have <optional>true</optional>.
If that is the case, then you will have to mention all of them again in your POM.