我在这里做:
see highest voted answer
添加到我的pom.xml
<profiles>
<profile>
<id>otherOutputDir</id>
<build>
<directory>yourDirectory</directory>
</build>
</profile>
</profiles>
在cmd中:
C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI>mvn compile -PotherOutputDir
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building hhsystem ui 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ ui ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1251 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ ui ---
[WARNING] File encoding has not been set, using platform encoding Cp1251, i.e. build is platform dependent!
[INFO] Compiling 11 source files to C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\yourDirectory\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] bad path element "": no such file or directory
C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\MyContextListener.java:[8,29]
cannot find symbol
symbol : class DatabaseHelper
location: package com.epam.hhsystem.util
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\MyContextListener.jav
a:[12,1] cannot find symbol
symbol : class DatabaseHelper
location: class com.epam.hhsystem.web.controllers.MyContextListener
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\MyApplicationListener
.java:[8,29] cannot find symbol
symbol : class DatabaseHelper
location: package com.epam.hhsystem.util
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\MyApplicationListener
.java:[14,1] cannot find symbol
symbol : class DatabaseHelper
location: class com.epam.hhsystem.web.controllers.MyApplicationListener
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\ApplicationWebListene
r.java:[9,29] cannot find symbol
symbol : class DatabaseHelper
location: package com.epam.hhsystem.util
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\ApplicationWebListene
r.java:[14,1] cannot find symbol
symbol : class DatabaseHelper
location: class com.epam.hhsystem.web.controllers.ApplicationWebListener
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[12,23] package org.apache.log4j does not exist
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[24,16] cannot find symbol
symbol : class Logger
location: class com.epam.hhsystem.web.controllers.CustomAuthentificationProvider
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\AbstractController.ja
va:[49,20] cannot find symbol
symbol : method getAllSkills()
location: class com.epam.hhsystem.services.UtilService
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[24,32] cannot find symbol
symbol : variable Logger
location: class com.epam.hhsystem.web.controllers.CustomAuthentificationProvider
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[59,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[63,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[64,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[65,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[66,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\VacancyMenuController
.java:[79,20] cannot find symbol
symbol : method getAllSkills()
location: class com.epam.hhsystem.services.UtilService
[INFO] 16 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.463s
[INFO] Finished at: Wed Oct 23 15:27:20 MSK 2013
[INFO] Final Memory: 21M/162M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project ui:
Compilation failure: Compilation failure:
[ERROR] bad path element "": no such file or directory
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\MyContextListener.jav
a:[8,29] cannot find symbol
[ERROR] symbol : class DatabaseHelper
[ERROR] location: package com.epam.hhsystem.util
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\MyContextListener.jav
a:[12,1] cannot find symbol
[ERROR] symbol : class DatabaseHelper
[ERROR] location: class com.epam.hhsystem.web.controllers.MyContextListener
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\MyApplicationListener
.java:[8,29] cannot find symbol
[ERROR] symbol : class DatabaseHelper
[ERROR] location: package com.epam.hhsystem.util
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\MyApplicationListener
.java:[14,1] cannot find symbol
[ERROR] symbol : class DatabaseHelper
[ERROR] location: class com.epam.hhsystem.web.controllers.MyApplicationListener
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\ApplicationWebListene
r.java:[9,29] cannot find symbol
[ERROR] symbol : class DatabaseHelper
[ERROR] location: package com.epam.hhsystem.util
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\ApplicationWebListene
r.java:[14,1] cannot find symbol
[ERROR] symbol : class DatabaseHelper
[ERROR] location: class com.epam.hhsystem.web.controllers.ApplicationWebListener
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[12,23] package org.apache.log4j does not exist
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[24,16] cannot find symbol
[ERROR] symbol : class Logger
[ERROR] location: class com.epam.hhsystem.web.controllers.CustomAuthentificationProvider
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\AbstractController.ja
va:[49,20] cannot find symbol
[ERROR] symbol : method getAllSkills()
[ERROR] location: class com.epam.hhsystem.services.UtilService
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[24,32] cannot find symbol
[ERROR] symbol : variable Logger
[ERROR] location: class com.epam.hhsystem.web.controllers.CustomAuthentificationProvider
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[59,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[63,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[64,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[65,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[66,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\VacancyMenuController
.java:[79,20] cannot find symbol
[ERROR] symbol : method getAllSkills()
[ERROR] location: class com.epam.hhsystem.services.UtilService
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI>
这个问题的原因是什么?
更新
ChristophT,
C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI>mvn -P otherOutputDir compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building hhsystem ui 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ ui ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1251 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ ui ---
[WARNING] File encoding has not been set, using platform encoding Cp1251, i.e. build is platform dependent!
[INFO] Compiling 11 source files to C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\yourDirectory\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] bad path element "": no such file or directory
C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\MyContextListener.java:[8,29]
cannot find symbol
symbol : class DatabaseHelper
location: package com.epam.hhsystem.util
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\MyContextListener.jav
a:[12,1] cannot find symbol
symbol : class DatabaseHelper
location: class com.epam.hhsystem.web.controllers.MyContextListener
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\MyApplicationListener
.java:[8,29] cannot find symbol
symbol : class DatabaseHelper
location: package com.epam.hhsystem.util
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\MyApplicationListener
.java:[14,1] cannot find symbol
symbol : class DatabaseHelper
location: class com.epam.hhsystem.web.controllers.MyApplicationListener
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\ApplicationWebListene
r.java:[9,29] cannot find symbol
symbol : class DatabaseHelper
location: package com.epam.hhsystem.util
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\ApplicationWebListene
r.java:[14,1] cannot find symbol
symbol : class DatabaseHelper
location: class com.epam.hhsystem.web.controllers.ApplicationWebListener
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[12,23] package org.apache.log4j does not exist
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[24,16] cannot find symbol
symbol : class Logger
location: class com.epam.hhsystem.web.controllers.CustomAuthentificationProvider
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\AbstractController.ja
va:[49,20] cannot find symbol
symbol : method getAllSkills()
location: class com.epam.hhsystem.services.UtilService
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[24,32] cannot find symbol
symbol : variable Logger
location: class com.epam.hhsystem.web.controllers.CustomAuthentificationProvider
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[59,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[63,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[64,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[65,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[66,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\VacancyMenuController
.java:[79,20] cannot find symbol
symbol : method getAllSkills()
location: class com.epam.hhsystem.services.UtilService
[INFO] 16 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.632s
[INFO] Finished at: Wed Oct 23 16:19:42 MSK 2013
[INFO] Final Memory: 22M/257M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project ui:
Compilation failure: Compilation failure:
[ERROR] bad path element "": no such file or directory
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\MyContextListener.jav
a:[8,29] cannot find symbol
[ERROR] symbol : class DatabaseHelper
[ERROR] location: package com.epam.hhsystem.util
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\MyContextListener.jav
a:[12,1] cannot find symbol
[ERROR] symbol : class DatabaseHelper
[ERROR] location: class com.epam.hhsystem.web.controllers.MyContextListener
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\MyApplicationListener
.java:[8,29] cannot find symbol
[ERROR] symbol : class DatabaseHelper
[ERROR] location: package com.epam.hhsystem.util
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\MyApplicationListener
.java:[14,1] cannot find symbol
[ERROR] symbol : class DatabaseHelper
[ERROR] location: class com.epam.hhsystem.web.controllers.MyApplicationListener
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\ApplicationWebListene
r.java:[9,29] cannot find symbol
[ERROR] symbol : class DatabaseHelper
[ERROR] location: package com.epam.hhsystem.util
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\ApplicationWebListene
r.java:[14,1] cannot find symbol
[ERROR] symbol : class DatabaseHelper
[ERROR] location: class com.epam.hhsystem.web.controllers.ApplicationWebListener
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[12,23] package org.apache.log4j does not exist
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[24,16] cannot find symbol
[ERROR] symbol : class Logger
[ERROR] location: class com.epam.hhsystem.web.controllers.CustomAuthentificationProvider
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\AbstractController.ja
va:[49,20] cannot find symbol
[ERROR] symbol : method getAllSkills()
[ERROR] location: class com.epam.hhsystem.services.UtilService
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[24,32] cannot find symbol
[ERROR] symbol : variable Logger
[ERROR] location: class com.epam.hhsystem.web.controllers.CustomAuthentificationProvider
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[59,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[63,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[64,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[65,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\CustomAuthentificatio
nProvider.java:[66,17] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.Hashtable
[ERROR] C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI\src\main\java\com\epam\hhsystem\web\controllers\VacancyMenuController
.java:[79,20] cannot find symbol
[ERROR] symbol : method getAllSkills()
[ERROR] location: class com.epam.hhsystem.services.UtilService
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI>
最佳答案
mvn命令在目标之前使用选项。另外,-P
和otherOutputDir
之间缺少空格。因此,以下命令应该起作用:
mvn -P otherOutputDir compile
关于java - 错误的路径元素“”:maven中没有这样的文件或目录可以编译,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19540871/