I was using ANT to deploy my stuff to Tomcat. But I had trouble with missing dependencies and I wanted to add Ivy, cause it was reccomended.
Now I added this to my build.xml file:
<!-- Ivy settings start-->
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
</condition>
<target name="download-ivy" unless="offline">
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="init-ivy" depends="download-ivy">
<!-- try to load ivy here from ivy home, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<target name="go" depends="init-ivy" description="--> resolve dependencies, compile and run the project">
<echo message="using ivy to resolve commons-lang 2.1..."/>
<!--
here comes the magic line: asks ivy to resolve a dependency on commons-lang 2.1 and to build an ant path with it from its cache
-->
<ivy:cachepath organisation="commons-lang" module="commons-lang" revision="2.1" pathid="lib.path.id" inline="true"/>
</target>
<!-- Ivy settings end-->
With this I am trying to add common-lang JAR file to my project.
This is what I get as output:
Buildfile: C:\Users\Jansu\workspace\HelloWorld\build.xml
build:
deploywar:
download-ivy:
[get] Getting: http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.2.0/ivy-2.2.0.jar
[get] To: C:\Users\Jansu\.ant\lib\ivy-2.2.0.jar
[get] Not modified - so not downloaded
init-ivy:
go:
[echo] using ivy to resolve commons-lang 2.1...
[ivy:cachepath] :: Ivy 2.2.0 - 20100923230623 :: http://ant.apache.org/ivy/ ::
[ivy:cachepath] :: loading settings :: url = jar:file:/C:/Users/Jansu/.ant/lib/ivy-2.2.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
[ivy:cachepath] :: resolving dependencies :: commons-lang#commons-lang-caller;working
[ivy:cachepath] confs: [default, master, compile, provided, runtime, system, sources, javadoc, optional]
[ivy:cachepath] found commons-lang#commons-lang;2.1 in public
[ivy:cachepath] :: resolution report :: resolve 151ms :: artifacts dl 10ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 1 | 0 | 0 | 0 || 1 | 0 |
| master | 1 | 0 | 0 | 0 || 1 | 0 |
| compile | 1 | 0 | 0 | 0 || 0 | 0 |
| provided | 1 | 0 | 0 | 0 || 0 | 0 |
| runtime | 1 | 0 | 0 | 0 || 0 | 0 |
| system | 1 | 0 | 0 | 0 || 0 | 0 |
| sources | 1 | 0 | 0 | 0 || 1 | 0 |
| javadoc | 1 | 0 | 0 | 0 || 1 | 0 |
| optional | 1 | 0 | 0 | 0 || 0 | 0 |
---------------------------------------------------------------------
BUILD SUCCESSFUL
Total time: 2 seconds
I guess it works..
now 2 questions:
1) where do those JAR files appear in my project?
2) how would I add other JAR files, such as Spring framework files?
This:
<ivy:cachepath organisation="commons-lang" module="commons-lang" revision="2.1" pathid="lib.path.id" inline="true"/>
</target>
is called an inline retrieval and tells Ivy to build an ant-path with pathid="lib.path.id" from the ivy cache the jars will not be copied to your project. The cache is in $ {user.home}/.ivy2.
If you want to download artifacts to your project you will have to use the retrieve task and define an ivy.xml for your project.
Related
Ive got a springboot application that when bundled into a docker image and published to Amazon ECS fails to start
The error message is:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| timestamp | message |
|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1645724032287 | . ____ _ __ _ _ |
| 1645724032287 | /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ |
| 1645724032287 | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ |
| 1645724032287 | \\/ ___)| |_)| | | | | || (_| | ) ) ) ) |
| 1645724032287 | ' |____| .__|_| |_|_| |_\__, | / / / / |
| 1645724032287 | =========|_|==============|___/=/_/_/_/ |
| 1645724032290 | :: Spring Boot :: |
| 1645724033092 | 17:33:53.090 [main] INFO com.jtmaxwell.Microservice.DocumentGenerator.Application - Starting Application using Java 11.0.14.1 on ip-172-31-20-189.eu-west-1.compute.internal with PID 1 (/app.jar started by root in /) |
| 1645724033093 | 17:33:53.093 [main] DEBUG com.jtmaxwell.Microservice.DocumentGenerator.Application - Running with Spring Boot, Spring |
| 1645724033093 | 17:33:53.093 [main] INFO com.jtmaxwell.Microservice.DocumentGenerator.Application - No active profile set, falling back to default profiles: default |
| 1645724033095 | 17:33:53.095 [main] DEBUG org.springframework.boot.SpringApplication - Loading source class com.jtmaxwell.Microservice.DocumentGenerator.Application |
| 1645724033893 | 17:33:53.893 [main] DEBUG org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext - Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#13acb0d1 |
| 1645724034087 | 17:33:54.087 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' |
| 1645724034591 | 17:33:54.590 [main] DEBUG org.springframework.context.annotation.ClassPathBeanDefinitionScanner - Identified candidate component class: URL [jar:file:/app.jar!/com/jtmaxwell/Microservice/DocumentGenerator/config/MessagingConfig.class] |
| 1645724034601 | 17:33:54.599 [main] DEBUG org.springframework.context.annotation.ClassPathBeanDefinitionScanner - Identified candidate component class: URL [jar:file:/app.jar!/com/jtmaxwell/Microservice/DocumentGenerator/consumer/User.class] |
| 1645724034697 | 17:33:54.693 [main] DEBUG org.springframework.context.annotation.ClassPathBeanDefinitionScanner - Identified candidate component class: URL [jar:file:/app.jar!/com/jtmaxwell/Microservice/DocumentGenerator/publisher/OrderPublisher.class] |
| 1645724035094 | 17:33:55.094 [main] ERROR org.springframework.boot.SpringApplication - Application run failed |
| 1645724035094 | java.lang.IllegalArgumentException: No auto configuration classes found in META-INF/spring.factories. If you are using a custom packaging, make sure that file is correct. |
| 1645724035094 | at org.springframework.util.Assert.notEmpty(Assert.java:470) |
| 1645724035094 | at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getCandidateConfigurations(AutoConfigurationImportSelector.java:180) |
| 1645724035094 | at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getAutoConfigurationEntry(AutoConfigurationImportSelector.java:123) |
| 1645724035094 | at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector$AutoConfigurationGroup.process(AutoConfigurationImportSelector.java:434) |
| 1645724035094 | at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGrouping.getImports(ConfigurationClassParser.java:879) |
| 1645724035094 | at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:809) |
| 1645724035094 | at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:780) |
| 1645724035094 | at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:193) |
| 1645724035094 | at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:331) |
| 1645724035094 | at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:247) |
| 1645724035094 | at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:311) |
| 1645724035094 | at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:112) |
| 1645724035094 | at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746) |
| 1645724035094 | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564) |
| 1645724035094 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) |
| 1645724035094 | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) |
| 1645724035094 | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) |
| 1645724035094 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) |
| 1645724035094 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) |
| 1645724035094 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290) |
| 1645724035094 | at com.jtmaxwell.Microservice.DocumentGenerator.Application.main(Application.java:18) |
| 1645724035293 | 17:33:55.290 [main] DEBUG org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext - Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#13acb0d1, started on Thu Feb 24 17:33:53 UTC 2022 |
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The pom.xml is
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.jtmaxwell</groupId>
<artifactId>microservice.documentgenerator</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Microservice.DocumentGenerator</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
</properties>
<repositories>
<repository>
<id>clojars.org</id>
<url>https://repo.clojars.org</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.github.erdos</groupId>
<artifactId>stencil-core</artifactId>
<version>0.3.29</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Can you please check first the docker images run outside of ECS? Seem there are some libs not got bundled as part of the docker build.
Also i assume your spring boot app runs locally
The answer here was as others highlighted. The image was missing dependencies due to the jar file from Visual Code being used for the docker build.
I ran the supplied
mvnw package
Then used the resulting jar file to build the docker image
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?
The Java 9 application I am building compiles and works well from IntelliJ IDE. On IDE, I have tried configuring as both Spring Boot application as well as plain Application and both configuration work well.
While executing maven build, I encounter RuntimeException with below stacktrace.
Caused by: java.lang.RuntimeException
at org.springframework.asm.ClassVisitor.visitModule(ClassVisitor.java:148)
at org.springframework.asm.ClassReader.readModule(ClassReader.java:762)
at org.springframework.asm.ClassReader.accept(ClassReader.java:663)
at org.springframework.asm.ClassReader.accept(ClassReader.java:527)
at org.springframework.boot.loader.tools.MainClassFinder.createClassDescriptor(MainClassFinder.java:267)
at org.springframework.boot.loader.tools.MainClassFinder.doWithMainClasses(MainClassFinder.java:223)
at org.springframework.boot.loader.tools.MainClassFinder.findSingleMainClass(MainClassFinder.java:203)
at org.springframework.boot.loader.tools.Repackager.findMainMethod(Repackager.java:365)
at org.springframework.boot.loader.tools.Repackager.findMainMethodWithTimeoutWarning(Repackager.java:354)
at org.springframework.boot.loader.tools.Repackager.buildManifest(Repackager.java:325)
at org.springframework.boot.loader.tools.Repackager.repackage(Repackager.java:255)
at org.springframework.boot.loader.tools.Repackager.repackage(Repackager.java:248)
at org.springframework.boot.loader.tools.Repackager.repackage(Repackager.java:193)
at org.springframework.boot.maven.RepackageMojo.repackage(RepackageMojo.java:221)
at org.springframework.boot.maven.RepackageMojo.execute(RepackageMojo.java:208)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 22 more
On analyzing, its being caused because of the ASM api level provided. With direct execution, it is org.springframework.asm.Opcodes#ASM6, but when using maven build it is Opcodes#ASM4 which is causing the issue.
Further analysis reveals that the instances are created as below -
Maven Build - https://github.com/spring-projects/spring-boot/blob/d3c34ee3d1bfd3db4a98678c524e145ef9bca51c/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java#L301
IDE Execution - https://github.com/spring-projects/spring-framework/blob/43b5e21947f3ad9682ae39cd8b8b5ae4b8f72c14/spring-core/src/main/java/org/springframework/core/type/classreading/ClassMetadataReadingVisitor.java#L71
Let me know if I need to report this as an issue with Spring Framework or if any workarounds exist.
Maven Version: 3.5.0
Spring Boot: 2.0.0.M5
Its a modular build and POM files are here: https://gist.github.com/techpavan/faa81d46321004cd50e7403b03d70a2e
A simpler reproducer is available here - https://github.com/techpavan/java9-maven-spring-boot
With this reproducer, you can find that maven build fails readily. But when put a breakpoint at org.springframework.asm.ClassVisitor > line 78 (Constructor) and update the api value during execution to 393216 (ASM6), you'll find that the build completes successfully. By default the value is set to 262144 (ASM4) which fails at line 147.
Update: The issue is accepted as bug by Spring community and should be fixed in Milestone 6 release - https://github.com/spring-projects/spring-boot/issues/10647
Update: The issue is fixed in the spring-boot master branch on Oct 17, 2017. Should be a part of M6 release.
Your mvn dependency:tree describes it as follows:-
➜[main] [INFO] +- org.springframework.boot:spring-boot-starter-jetty:jar:2.0.0.M5:compile
[main] [INFO] | +- org.eclipse.jetty:jetty-servlets:jar:9.4.7.v20170914:compile
[main] [INFO] | | +- org.eclipse.jetty:jetty-continuation:jar:9.4.7.v20170914:compile
[main] [INFO] | | +- org.eclipse.jetty:jetty-http:jar:9.4.7.v20170914:compile
[main] [INFO] | | +- org.eclipse.jetty:jetty-util:jar:9.4.7.v20170914:compile
[main] [INFO] | | \- org.eclipse.jetty:jetty-io:jar:9.4.7.v20170914:compile
[main] [INFO] | +- org.eclipse.jetty:jetty-webapp:jar:9.4.7.v20170914:compile
[main] [INFO] | | +- org.eclipse.jetty:jetty-xml:jar:9.4.7.v20170914:compile
[main] [INFO] | | \- org.eclipse.jetty:jetty-servlet:jar:9.4.7.v20170914:compile
[main] [INFO] | | \- org.eclipse.jetty:jetty-security:jar:9.4.7.v20170914:compile
[main] [INFO] | | \- org.eclipse.jetty:jetty-server:jar:9.4.7.v20170914:compile
[main] [INFO] | +- org.eclipse.jetty.websocket:websocket-server:jar:9.4.7.v20170914:compile
[main] [INFO] | | +- org.eclipse.jetty.websocket:websocket-common:jar:9.4.7.v20170914:compile
[main] [INFO] | | | \- org.eclipse.jetty.websocket:websocket-api:jar:9.4.7.v20170914:compile
[main] [INFO] | | +- org.eclipse.jetty.websocket:websocket-client:jar:9.4.7.v20170914:compile
[main] [INFO] | | | \- org.eclipse.jetty:jetty-client:jar:9.4.7.v20170914:compile
[main] [INFO] | | \- org.eclipse.jetty.websocket:websocket-servlet:jar:9.4.7.v20170914:compile
[main] [INFO] | | \- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[main] [INFO] | +- org.eclipse.jetty.websocket:javax-websocket-server-impl:jar:9.4.7.v20170914:compile
[main] [INFO] | | +- org.eclipse.jetty:jetty-annotations:jar:9.4.7.v20170914:compile
[main] [INFO] | | | +- org.eclipse.jetty:jetty-plus:jar:9.4.7.v20170914:compile
➜[main] [INFO] | | | +- org.ow2.asm:asm:jar:5.1:compile
[main] [INFO] | | | \- org.ow2.asm:asm-commons:jar:5.1:compile
[main] [INFO] | | | \- org.ow2.asm:asm-tree:jar:5.1:compile
This clearly reflects that the dependency on spring-boot-starter-jetty for your project relies on asm:5.1 and the version of asm is not compatible with the latest Java release. You can try upgrading to 6.0_BETA version of it.
To what I got to know from this issue, jetty didn't upgrade to the latest version because of its incompatibility with OSGI version number. I'd faced that issue while trying to make vaadin8 application work with Java 9 wherein the solution I could achieve was to build jetty locally and then use a custom version in my project as stated in the answer -
This was attained after overcoming the #jetty.project/1758 by
upgrading to the 6.0_BETA of asm and asm-commons libraries and using
the custom 9.4.7-SNAPSHOT built on my local used in the project(commit
- #e34415.)
Update: This indeed is a bug in spring-boot milestone as confirmed in the edited question as well.
Thanks to wilkinsona on GitHub whose workaround helped me on this issue. Just adding a spring-boot-maven-plugin configuration with mainClass entry can solve this problem on M5 release. Expected to have a proper fix on M6.
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
+ <configuration>
+ <mainClass>com.test.TestMain</mainClass>
+ </configuration>
</plugin>
I would like to know all transitive dependencies of the following jar:
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xmlbeans-maven-plugin</artifactId>
<version>2.3.3</version>
</dependency>
Moving a classic command to the pom.xml of the project's defining that dependency and inputting:
mvn dependency:tree
would show:
+- org.codehaus.mojo:xmlbeans-maven-plugin:jar:2.3.3:compile
| +- xml-resolver:xml-resolver:jar:1.2:compile
| +- org.apache.maven:maven-model:jar:2.0.6:compile
| +- org.apache.maven:maven-artifact:jar:2.0.6:compile
| +- org.apache.maven:maven-project:jar:2.0.6:compile
| | +- org.apache.maven:maven-settings:jar:2.0.6:compile
| | +- org.apache.maven:maven-profile:jar:2.0.6:compile
| | +- org.apache.maven:maven-artifact-manager:jar:2.0.6:compile
| | | +- org.apache.maven:maven-repository-metadata:jar:2.0.6:compile
| | | \- org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:compile
| | +- org.apache.maven:maven-plugin-registry:jar:2.0.6:compile
| | \- org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
| | +- junit:junit:jar:3.8.1:compile
| | \- classworlds:classworlds:jar:1.1-alpha-2:compile
| +- org.apache.maven:maven-plugin-api:jar:2.0.6:compile
| +- org.apache.xmlbeans:xmlbeans:jar:2.4.0:compile
| | \- stax:stax-api:jar:1.0.1:compile
| \- org.codehaus.plexus:plexus-utils:jar:1.5.6:compile
I don't see the mojo-parent:
<groupId>org.codehaus.mojo</groupId>
<artifactId>mojo-parent</artifactId>
<version>21</version>
<packaging>pom</packaging>
At first glance it seems that the mvn command can show the dependencies which are not pom type.
Is there a way to show exactly every single file needed to keep a jar alive?
Thanks!
Actually it's hard to show files needed to 'keep a jar alive'. Your project can have some implicit dependencies.
You can run mvn dependency:analyze, it should show you unused dependencies.
But you have realize which of them you can freely remove. http://maven.apache.org/plugins/maven-dependency-plugin/analyze-mojo.html
I can also recommend if you don't want any surprises with transitive dependencies - use maven enforcer. You can ban all undeclared transitive dependencies.
http://maven.apache.org/enforcer/enforcer-rules/banTransitiveDependencies.html
I am a pig newbie and have been trying to get it running on my Windows 7 machine. My hadoop (2.4.0) works fine on my local machine, but whenever I try to run a simple Pig script, it throws up errors whenever I try to dump the contents of a file.
Going off of a solution for a similar issue, found here, I have tried to rebuild my Pig (0.12.1) using Ant.
Whenever I run
ant clean jar-withouthadoop -Dhadoopversion=23
I get the following errors:
Buildfile: C:\pig-0.12.1-src\build.xml
......
[org.apache.ftpserver#ftpserver-core;1.0.0] in [hadoop20]
[ivy:resolve] org.apache.mina#mina-core;2.0.0-M2 by [org.apache.mina#mina-core;2.0.0-M5] in [hadoop20]
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| master | 0 | 0 | 0 | 0 || 0 | 0 |
| default | 101 | 32 | 0 | 3 || 101 | 0 |
| runtime | 101 | 32 | 0 | 3 || 101 | 0 |
| compile | 89 | 29 | 0 | 2 || 90 | 0 |
| test | 101 | 32 | 0 | 3 || 101 | 0 |
| javadoc | 101 | 32 | 0 | 3 || 101 | 0 |
| releaseaudit | 3 | 2 | 0 | 0 || 3 | 0 |
| jdiff | 3 | 0 | 0 | 0 || 3 | 0 |
| checkstyle | 10 | 3 | 0 | 0 || 10 | 0 |
| buildJar | 101 | 32 | 0 | 3 || 101 | 0 |
| hadoop20 | 48 | 30 | 0 | 9 || 39 | 0 |
| hadoop23 | 40 | 13 | 0 | 0 || 42 | 0 |
| hbase94 | 1 | 0 | 0 | 0 || 2 | 0 |
| hbase95 | 7 | 0 | 0 | 0 || 13 | 0 |
---------------------------------------------------------------------
ivy-compile:
[ivy:retrieve] :: retrieving :: org.apache.pig#pig
[ivy:retrieve] confs: [compile]
[ivy:retrieve] 90 artifacts copied, 0 already retrieved (80170kB/407ms)
[ivy:cachepath] DEPRECATED: 'ivy.conf.file' is deprecated, use 'ivy.settings.file' instead
[ivy:cachepath] :: loading settings :: file = C:\pig-0.12.1-src\ivy\ivysettings.xml
init:
[mkdir] Created dir: C:\pig-0.12.1-src\src-gen\org\apache\pig\impl\logicalLayer\parser
[mkdir] Created dir: C:\pig-0.12.1-src\src-gen\org\apache\pig\tools\pigscript\parser
[mkdir] Created dir: C:\pig-0.12.1-src\src-gen\org\apache\pig\tools\parameters
[mkdir] Created dir: C:\pig-0.12.1-src\build\classes
[mkdir] Created dir: C:\pig-0.12.1-src\build\test\classes
[mkdir] Created dir: C:\pig-0.12.1-src\test\org\apache\pig\test\utils\dotGraph\parser
[mkdir] Created dir: C:\pig-0.12.1-src\src-gen\org\apache\pig\data\parser
[move] Moving 1 file to C:\pig-0.12.1-src\build\ivy\lib\Pig
cc-compile:
[javacc] Java Compiler Compiler Version 4.2 (Parser Generator)
[javacc] (type "javacc" with no arguments for help)
[javacc] Reading from file C:\pig-0.12.1-
....
[javacc] Parser generated successfully.
prepare:
[mkdir] Created dir: C:\pig-0.12.1-src\src-gen\org\apache\pig\parser
genLexer:
[java] error(1): cannot write file : java.io.FileNotFoundException: C:\pig-0.12.1-src\src-gen\org\apache\pig\parser\C:\QueryLexer.java (The filename, directory name, or volume label syntax is incorrect)
[java] java.io.FileOutputStream.open(Native Method)
[java] java.io.FileOutputStream.<init>(FileOutputStream.java:221)
[java] java.io.FileOutputStream.<init>(FileOutputStream.java:171)
[java] java.io.FileWriter.<init>(FileWriter.java:90)
[java] org.antlr.Tool.getOutputFile(Tool.java:871)
[java] org.antlr.codegen.CodeGenerator.write(CodeGenerator.java:1262)
[java] org.antlr.codegen.Target.genRecognizerFile(Target.java:94)
[java] org.antlr.codegen.CodeGenerator.genRecognizer(CodeGenerator.java:460)
[java] org.antlr.Tool.generateRecognizer(Tool.java:655)
[java] org.antlr.Tool.process(Tool.java:468)
[java] org.antlr.Tool.main(Tool.java:93)
BUILD FAILED
C:\pig-0.12.1-src\build.xml:495 Java returned: 1
What am I doing wrong here? Am I missing files, or is this configuration issue in build.xml?
EDIT: I have run this command from both the cmd and cygwin terminal. They both output the same error.
EDIT2: I'm building with Ant (1.9.4)
FINAL EDIT: Turns out I needed to move the pig src archive (pig-0.12.1-src.tar.gz) to the cygwin home directory, unzip it, cd into the unzipped archive and run the command.
I had the same problem. I solved it by compiling pig via cygwin in my cygwin home.
My ivy settings were as such :
<ivysettings>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
see http://www.jayasoft.org/ivy/doc/configuration
-->
<!-- you can override this property to use mirrors
http://repo1.maven.org/maven2/
http://mirrors.dotsrc.org/maven2
http://ftp.ggi-project.org/pub/packages/maven2
http://mirrors.sunsite.dk/maven2
http://public.planetmirror.com/pub/maven2
http://ibiblio.lsu.edu/main/pub/packages/maven2
http://www.ibiblio.net/pub/packages/maven2
-->
<property name="repo.maven.org" value="${mvnrepo}" override="true"/>
<property name="repo.jboss.org" value="http://repository.jboss.com/nexus/content/groups/public/" override="false"/>
<property name="repo.apache.snapshots" value="http://repository.apache.org/content/groups/snapshots-group/" override="false"/>
<property name="repo.dir" value="${user.home}/.m2/repository" override="false"/>
<property name="maven2.pattern" value="[organisation]/[module]/[revision]/[module]-[revision](-[classifier])"/>
<property name="maven2.pattern.ext" value="${maven2.pattern}.[ext]"/>
<property name="snapshot.pattern" value="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
<property name="resolvers" value="default" override="false"/>
<property name="force-resolve" value="false" override="false"/>
<!-- pull in the local repository -->
<include url="${ivy.default.conf.dir}/ivyconf-local.xml"/>
<settings defaultResolver="${resolvers}"/>
<resolvers>
<ibiblio name="maven2" root="${repo.maven.org}" pattern="${maven2.pattern.ext}" m2compatible="true"/>
<ibiblio name="jboss-maven2" root="${repo.jboss.org}" pattern="${maven2.pattern.ext}" m2compatible="true"/>
<ibiblio name="apache-snapshots" root="${repo.apache.snapshots}" pattern="${snapshot.pattern}"
checkmodified="true" changingPattern=".*SNAPSHOT" m2compatible="true"/>
<filesystem name="fs" m2compatible="true" checkconsistency="false" force="${force-resolve}"
checkmodified="true" changingPattern=".*SNAPSHOT">
<artifact pattern="${repo.dir}/${maven2.pattern.ext}"/>
<ivy pattern="${repo.dir}/[organisation]/[module]/[revision]/[module]-[revision].pom"/>
</filesystem>
<chain name="internal" checkmodified="true">
<resolver ref="fs"/>
</chain>
<chain name="external" dual="true">
<resolver ref="maven2"/>
<resolver ref="jboss-maven2"/>
<resolver ref="apache-snapshots"/>
</chain>
<chain name="default" dual="true" checkmodified="true">
<resolver ref="internal"/>
<resolver ref="external"/>
</chain>
</resolvers>
<modules>
<module organisation="org.apache.pig" name=".*" resolver="internal"/>
</modules>
</ivysettings>