0

I'm trying to run a project from the Maven command line that already runs OK in Eclipse. When I have "Apache Tomcat 7.0" on the Eclipse build path it works. When I don't, it fails with the exact error it gives from the command line. Therefore I suspect this difference is all that's required to run it from the command line. What is the equivalent, if running on the command line using Maven, of adding "Apache Tomcat 7.0" in Eclipse as a targeted runtime?

shiggity
  • 531
  • 4
  • 12

2 Answers2

0

You may have to export the JAVA_HOME path in your command line session. Eclipse adds the opt params at execution of the maven task.

Here is an example: Specify JDK for Maven to use

Community
  • 1
  • 1
John Giotta
  • 16,432
  • 7
  • 52
  • 82
0

Eclipse add some stuff for you, If you want to avoid this problem, you have to add all the thing that you need manually using maven,in the <build> tag you can add a tag named <resources>, there you can add manually all the thing that you are adding in the java build path, e.g :

<build>
    <resources>
                <resource>
                    <directory>src/main/resources</directory>
                    <filtering>true</filtering>
                    <includes>
                        <include>configProperties/serverContextConfig.properties</include>
                    </includes>
                </resource>
                <resource>
                    <directory>src/main/resources</directory>
                    <filtering>false</filtering>
                    <includes>
                        <include>**/*.properties</include>
                    </includes>
                </resource>
                <resource>
                    <directory>src/main/resources</directory>
                    <filtering>false</filtering>
                    <includes>
                        <include>report/documents/*.*</include>
                    </includes>
                </resource>
            </resources>
</build>

By default, Maven will look for your project's resources under src/main/resources.

Project
|-- pom.xml
`-- src
    `-- main
        `-- resources

However, all your resources may not be in src/main/resources. Thus, you'd have to specify those directories by adding the following to your POM.

<project>
 ...
 <build>
   ...
   <resources>
     <resource>
       <directory>[your folder here]</directory>
     </resource>
   </resources>
   ...
 </build>
 ...
</project>

Click here for more information.