Announcement Announcement Module
Collapse
No announcement yet.
How do I use CommandLineJobRunner? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Thank you, arno!!!!!!!! It was a long day(s) for me, I'm relieved to finally see "Hello World".

    Your suggestion of mvn dependency:copy-dependencies is immensely useful, now I know to just type that if I really need to extract all dependencies.

    With a working directory of :
    Code:
    hello-world-job.xml
    aopalliance-1.0.jar
    commons-io-1.4.jar
    commons-lang-2.6.jar
    commons-logging-1.1.1.jar
    h2-1.3.154.jar
    hello-world-solution-1.0.0.jar
    jcl-over-slf4j-1.6.1.jar
    jettison-1.1.jar
    junit-4.8.2.jar
    logback-classic-0.9.28.jar
    logback-core-0.9.28.jar
    slf4j-api-1.6.1.jar
    spring-aop-3.0.5.RELEASE.jar
    spring-asm-3.0.5.RELEASE.jar
    spring-batch-core-2.1.7.RELEASE.jar
    spring-batch-infrastructure-2.1.7.RELEASE.jar
    spring-beans-3.0.5.RELEASE.jar
    spring-context-3.0.5.RELEASE.jar
    spring-core-3.0.5.RELEASE.jar
    spring-expression-3.0.5.RELEASE.jar
    spring-jdbc-3.0.5.RELEASE.jar
    spring-test-3.0.5.RELEASE.jar
    spring-tx-3.0.5.RELEASE.jar
    xpp3_min-1.1.4c.jar
    xstream-1.3.jar
    I typed:
    Code:
    java -classpath "./*" org.springframework.batch.core.launch.support.CommandLineJobRunner hello-world-job.xml helloWorldJob
    And, like you said, I got a LOT of logging output (167 lines...btw is there a way to turn off this logging?). One of them was "Hello world!". I can't tell you how much this helps, thanks a lot!

    Comment


    • #17
      for the logging, you can copy the logback-test.xml file in src/test/resources to src/main/resources and rename it logback.xml. Then package again, copy the hello-world-1.0.0.jar to the working, and try.

      packaging and launching a Java program is a pain if you're not used to (especially with the dependencies). This isn't a Spring Batch problem actually. When developing Spring Batch jobs, you should stay inside your IDE, and package everything up only for integration testing and production.

      Comment


      • #18
        Bleh, my IDE is usually console and vi.

        One last question while on the topic: is there a way I can take the hello-world-solution maven project, and move it to its own independent maven project. It seems dependent on the others, here's its pom.xml:

        Code:
        <?xml version="1.0"?>
        <project
                xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
                xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <modelVersion>4.0.0</modelVersion>
                <parent>
                        <artifactId>springbatch</artifactId>
                        <groupId>com.zenika.workshop</groupId>
                        <version>1.0.0</version>
                </parent>
                <artifactId>hello-world-solution</artifactId>
        
        </project>
        Any kind of magical maven command that creates a new project and a new pom.xml that doesn't depend on the parent?

        Comment


        • #19
          Bleh, my IDE is usually console and vi.
          good luck for Java development then!

          One last question while on the topic: is there a way I can take the hello-world-solution maven project, and move it to its own independent maven project. It seems dependent on the others, here's its pom.xml:

          Code:
          <?xml version="1.0"?>
          <project
                  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
                  xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                  <modelVersion>4.0.0</modelVersion>
                  <parent>
                          <artifactId>springbatch</artifactId>
                          <groupId>com.zenika.workshop</groupId>
                          <version>1.0.0</version>
                  </parent>
                  <artifactId>hello-world-solution</artifactId>
          
          </project>
          Any kind of magical maven command that creates a new project and a new pom.xml that doesn't depend on the parent?
          there's no magic command for this. The parent POM declares the dependencies and as you can see, the POM for the hello world project is quite empty. Welcome to the Maven world!

          Comment


          • #20
            So, I can't create a hello-world-solution that's its own project, without needing to be a subproject of Spring-Batch-Workshop?

            Comment


            • #21
              yes you can.

              Comment

              Working...
              X