我正在使用带有以下命令的Exec Maven插件:
mvn exec:java
我没有设法用这种执行模式设置工作目录.我想使用mainClass(在特定的包中),我希望我的执行的根文件夹在$ {basedir}之外的另一个目录中.
谢谢您的帮助.
我的pom.xml目标<workingDirectory>对我不起作用:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<workingDirectory>${project.build.directory}\classes</workingDirectory>
<mainClass>com.package.MyMainClass</mainClass>
<includeProjectDependencies>true</includeProjectDependencies>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
使用-X选项的结果
[DEBUG] Configuring mojo org.codehaus.mojo:exec-maven-plugin:1.3.2:java from plugin realm ClassRealm[plugin>org.codehaus.mojo:exec-maven-plugin:1.3.2,parent: sun.misc.Launcher$AppClassLoader@11b86e7]
[DEBUG] Configuring mojo 'org.codehaus.mojo:exec-maven-plugin:1.3.2:java' with basic configurator -->
[DEBUG] (f) arguments = []
[DEBUG] (f) classpathScope = runtime
[DEBUG] (f) cleanupDaemonThreads = true
[DEBUG] (f) daemonThreadJoinTimeout = 15000
[DEBUG] (f) includePluginDependencies = false
[DEBUG] (f) includeProjectDependencies = true
[DEBUG] (f) keepAlive = false
[DEBUG] (f) killAfter = 1 …Run Code Online (Sandbox Code Playgroud) 我只是创建我的自定义原型项目,并完美地运行" mvn install "命令.
在我的本地存储库中,我的原型项目通过正确添加m2/repository/com/mycomp/archetype-project-name.
(但它不是在原型文件夹中创建的m2/repository/org/apache/maven/archetypes::也许这是正常的)
但现在我无法使用我的新自定义原型和"mvn archetype:generation"命令:
我mvn deploy也应该执行命令吗?我试过这个,但我还没有配置另一个内部存储库,它失败了.
提前感谢您的帮助
我正在做一个Spring MVC控制器,我仍然遇到POST操作问题.我已经在stackoverflow上阅读了许多解决方案而无法解决我的问题.
我目前的成就:
POST用JSON正文发送请求,return = 415 UNSUPPORTED_MEDIA_TYPE1)我在我的pom.xml中添加了Jackson API:1.8.5
2)我的Spring配置文件:我添加了所有必要的部分:
3)我的模型对象很简单:具有Id,Name和金额的账户
@Document
public class Account implements Serializable {
private static final long serialVersionUID = 9058933587701674803L;
@Id
private String id;
private String name;
private Double amount=0.0;
// and all get and set methods
Run Code Online (Sandbox Code Playgroud)
4)最后我简化的Controller类:
@Controller
public class AdminController {
@RequestMapping(value="/account", method=RequestMethod.POST,
headers = {"content-type=application/json"})
@ResponseStatus( HttpStatus.CREATED )
public void addAccount(@RequestBody Account account){
log.debug("account from json request " + account);
}
@RequestMapping(value="/account/{accountId}", method=RequestMethod.GET) …Run Code Online (Sandbox Code Playgroud)