1

I'm using Intellij Idea 14 and start learning embedded Maven installation. At now Maven compile sources, generate JAR with MANIFEST.MF inside (with 'lib/' prefixes in 'Class-Path') to 'target/', copy dependencies at 'target/lib/' folder, copy folder 'src/main/resources/cfg' to 'target/cfg'. If i manually go to folder 'target' and start app with 'java -jar app.jar' then it works fine and successfully find folder 'cfg', but if i start app from Idea then app triyng to search folder 'cfg' in base project folder. There is some POM piece:

            <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.4.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <executable>java</executable>
                <workingDirectory>${project.build.directory}\</workingDirectory>
                <mainClass>app.Main</mainClass>
            </configuration>
        </plugin>

I looked at workingDirectory parameter [ http://www.mojohaus.org/exec-maven-plugin/exec-mojo.html ]. This won't work. How can i change working folder to 'target'? This is for comfort app develop and run/debug right from Idea. I need to get that result application structure:

  • /app.jar
  • /cfg
  • /cfg/application.cfg
lanmaster
  • 330
  • 2
  • 16
  • 1
    In Run configurations, you can try changing 'Working Directory' path – hsnkhrmn Dec 04 '15 at 12:37
  • I try to change in "Run/Debug Configurations" / "Parameters" / "Working directory" - add "/target" to the end of the path. But there is Maven error occured: "[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (D:\projects\projectfolder\target). Please verify you invoked Maven from the correct directory. org.apache.maven.lifecycle.MissingProjectException: The goal you specified requires a project to execute but there is no POM in this directory (D:\projects\projectfolder\target). Please verify you invoked Maven from the correct directory." – lanmaster Dec 07 '15 at 05:20

0 Answers0