简体   繁体   English

Jenkins的工作是从多模块Maven项目中部署War文件

[英]Jenkins job for deploying a war file out of a multi module maven project

I try to setup Jenkins jobs for deploying war files of my multi module maven project. 我尝试设置Jenkins作业以部署多模块Maven项目的war文件。 My Project structure is comparable to this: 我的项目结构与此类似:

--Platform
 |-- Core
   |-- ...
 |-- Backend
   |-- BackendWeb
 |-- Frontend
   |-- WebFrotnend1
   |-- WebService
   |-- ...

I've managed to create a job which retrieves the root (Platform) from SVN and build everything with Maven. 我设法创建了一个从SVN检索根(平台)的作业,并使用Maven构建了所有内容。 The war files built by this job are working fine when I deploy them by hand. 当我手动部署它们时,由此作业构建的war文件可以正常工作。

Now I want to create a job for building and deploying for example only the "BackendWeb" module by means of the tomcat-maven-plugin. 现在,我想通过tomcat-maven-plugin创建仅用于构建和部署“ BackendWeb”模块的作业。

To achieve this I've tried to create another job, which simply retrieves the single module and not the whole project and execute the tomcat redeploy goal. 为此,我尝试创建另一个作业,该作业仅检索单个模块而不是整个项目,并执行tomcat重新部署目标。 At first sight the build and deployment seems fine, but in the tomcat logs I see the following: 乍一看,构建和部署似乎还不错,但是在tomcat日志中,我看到了以下内容:

Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.myproject.core.service.config.ConfigurationService]
: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problems:
        The import com.myproject.core.config.ConfigEntry cannot be resolved
        ConfigEntry cannot be resolved to a type
        The method getByKey(String) from the type ConfigurationDAO refers to the missing type ConfigEntry
        ConfigEntry cannot be resolved to a type
        ConfigEntry cannot be resolved to a type

        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:162)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:76)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:990)
        ... 69 more
Caused by: java.lang.Error: Unresolved compilation problems:
        The import com.myproject.core.config.ConfigEntry cannot be resolved
        ConfigEntry cannot be resolved to a type
        The method getByKey(String) from the type ConfigurationDAO refers to the missing type ConfigEntry
        ConfigEntry cannot be resolved to a type
        ConfigEntry cannot be resolved to a type

Did I forgot something ? 我忘了什么吗? I don't know why this build is different from the build of the first job, the dependencies should be taken from the same maven repository. 我不知道为什么这个版本不同于第一个工作的版本,依赖项应该来自同一个Maven存储库。

So far I did not find a solution for this issue on the web. 到目前为止,我尚未在网络上找到此问题的解决方案。 Is there a best practice in Jenkins to achieve this? 詹金斯是否有最佳实践来实现这一目标?

I simply forgot to add the clean task before tomcat:redeploy. 我只是忘了在tomcat:redeploy之前添加清洁任务。 Don't know why it took ages to find the solution ;( 不知道为什么要花很长时间才能找到解决方案;(

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM