{"id":4007,"date":"2014-11-25T20:31:19","date_gmt":"2014-11-25T15:01:19","guid":{"rendered":"\/?p=4007"},"modified":"2020-08-17T11:49:50","modified_gmt":"2020-08-17T06:19:50","slug":"maven-scr-plugin-error-aem","status":"publish","type":"post","link":"https:\/\/www.argildx.us\/technology\/maven-scr-plugin-error-aem\/","title":{"rendered":"How to Resolve a Maven-scr-Plugin Error in AEM"},"content":{"rendered":"
The idea for this article on resolving a Maven-scr-Plugin Error in AEM came about while building an AEM project using the Maven command. When we encountered this problem, we decided to explain the cause and the way to solve this error.<\/div>\n

\n<\/i><\/b><\/p>\n
mvn clean install -P <Profile Name><\/pre>\n<\/div>\n
The Maven-scr-plugin error description is as shown below<\/b><\/h6>\n
\n
[ERROR] Failed to execute goal org.apache.felix:maven-scr-plugin:1.7.4:scr (generate-scr-descriptor) on project blog-bundle: SCR Descriptor parsing had failures (see log) -> [Help 1]\r\n[ERROR]\u00a0\r\n[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.\r\n[ERROR] Re-run Maven using the -X switch to enable full debug logging.\r\n[ERROR]\u00a0\r\n[ERROR] For more information about the errors and possible solutions, please read the following articles:\r\n[ERROR] [Help 1] http:\/\/cwiki.apache.org\/confluence\/display\/MAVEN\/MojoFailureException\r\n[ERROR]\u00a0\r\n[ERROR] After correcting the problems, you can resume the build with the command\r\n\r\n\r\n[ERROR] \u00a0 mvn <goals> -rf :blog-bundle<\/pre>\n

 <\/p>\n<\/div>\n

Cause of Maven-scr-Plugin error<\/b><\/h6>\n
Most of the time this Maven-scr-pugin error occurs when you use the following two annotations together –<\/div>\n
@SlingServlet<\/i> and @Component\u00a0<\/i>same class.<\/div>\n
\n
<\/div>\n
For Example, if your coding syntax is<\/div>\n
<\/div>\n
\n
@SlingServlet(path=\"\/bin\/blog\" extension=\"html\")\r\n@Component\r\nClass TestServlet extends SlingSafeMethodsServlet { \/* \u00a0----------------------- *\/\u00a0}<\/pre>\n

 <\/p>\n

In this case you will get that error,\u00a0<\/i>because\u00a0@SlingServlet <\/i>has “generateComponent”<\/i> property and by default its value is “true”<\/em>\u00a0so ideally you don’t provide the\u00a0@Component<\/i>\u00a0annotation.<\/p>\n<\/div>\n<\/div>\n

How to resolve this Maven issue<\/b><\/h6>\n
There are two ways to resolve this issue –<\/div>\n
    \n
  1. Remove\u00a0@Component<\/b>\u00a0annotation while creating Sling Servlet.<\/li>\n
  2. The issues with the first solution are –\n
      \n
    1. Unable to activate this Sling Servlet immediately: <\/strong>The timing of activation of this Sling Servlet\u00a0is totally dependent on Felix <\/b>implementation. This means it may or may not be in active state after deploying the package.<\/li>\n
    2. We are not able to use\u00a0immediate, enabled metatype<\/b> and other properties provided by @Component.<\/b><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n

      \n<\/i>The preferred way to use these annotations is<\/b><\/h6>\n
      \n
      @SlingServlet(path=\"\/bin\/blog\" extension=\"html\",\u00a0generateComponent=false)\r\n@Component\r\nClass TestServlet extends SlingSafeMethodsServlet {\u00a0\/* \u00a0----------------------- *\/\u00a0}<\/pre>\n<\/div>\n

      I hope this article helped you understand the reason for Maven-scr-Plugin Error in AEM and how to resolve this issue.<\/p>\n

      You can also read about another Maven issue – Maven Dependencies Version Issue in AEM<\/a> available in our Blog.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"

      The idea for this article on resolving a Maven-scr-Plugin Error in AEM came about while building an AEM project using the Maven command. When we encountered this problem, we decided to explain the cause and the way to solve this error. mvn clean install -P <Profile Name> The Maven-scr-plugin error description is as shown below … Read more<\/a><\/p>\n","protected":false},"author":29,"featured_media":6989,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","content-type":"","footnotes":""},"categories":[66],"tags":[25,27,64],"yst_prominent_words":[1368,1366,1371,534,1370,1613,1615,1367,1617,1369,1402,1618,1614,1612,1616,1373,1364,836,835,825],"acf":[],"yoast_head":"\nMaven-scr-Plugin Error in AEM and how to Resolve this Issue | Argil DX<\/title>\n<meta name=\"description\" content=\"Maven-scr-Plugin Error in AEM is caused when Sling Servlet and Component annotations are used together. Learn to resolve Maven Dependencies Version Issue.\" \/>\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.argildx.us\/technology\/maven-scr-plugin-error-aem\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Maven-scr-Plugin Error in AEM and how to Resolve this Issue | Argil DX\" \/>\n<meta property=\"og:description\" content=\"Maven-scr-Plugin Error in AEM is caused when Sling Servlet and Component annotations are used together. Learn to resolve Maven Dependencies Version Issue.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.argildx.us\/technology\/maven-scr-plugin-error-aem\/\" \/>\n<meta property=\"og:site_name\" content=\"Argil DX\" \/>\n<meta property=\"article:published_time\" content=\"2014-11-25T15:01:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-08-17T06:19:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.argildx.us\/wp-content\/uploads\/2019\/07\/Maven-Dependencies-Version-Issue-in-AEM.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1440\" \/>\n\t<meta property=\"og:image:height\" content=\"542\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.argildx.us\/#website\",\"url\":\"https:\/\/www.argildx.us\/\",\"name\":\"Argil DX\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.argildx.us\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.argildx.us\/technology\/maven-scr-plugin-error-aem\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/www.argildx.us\/wp-content\/uploads\/2019\/07\/Maven-Dependencies-Version-Issue-in-AEM.jpg\",\"width\":1440,\"height\":542},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.argildx.us\/technology\/maven-scr-plugin-error-aem\/#webpage\",\"url\":\"https:\/\/www.argildx.us\/technology\/maven-scr-plugin-error-aem\/\",\"name\":\"Maven-scr-Plugin Error in AEM and how to Resolve this Issue | Argil DX\",\"isPartOf\":{\"@id\":\"https:\/\/www.argildx.us\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.argildx.us\/technology\/maven-scr-plugin-error-aem\/#primaryimage\"},\"datePublished\":\"2014-11-25T15:01:19+00:00\",\"dateModified\":\"2020-08-17T06:19:50+00:00\",\"author\":{\"@id\":\"https:\/\/www.argildx.us\/#\/schema\/person\/1c5b6f3f2f7218d9acb851588b98551f\"},\"description\":\"Maven-scr-Plugin Error in AEM is caused when Sling Servlet and Component annotations are used together. Learn to resolve Maven Dependencies Version Issue.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.argildx.us\/technology\/maven-scr-plugin-error-aem\/\"]}]},{\"@type\":[\"Person\"],\"@id\":\"https:\/\/www.argildx.us\/#\/schema\/person\/1c5b6f3f2f7218d9acb851588b98551f\",\"name\":\"Argil DX Media\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.argildx.us\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0ccbc04705942d1269cdf9f789e58484?s=96&d=mm&r=g\",\"caption\":\"Argil DX Media\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","_links":{"self":[{"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/posts\/4007"}],"collection":[{"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/comments?post=4007"}],"version-history":[{"count":0,"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/posts\/4007\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/media\/6989"}],"wp:attachment":[{"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/media?parent=4007"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/categories?post=4007"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/tags?post=4007"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/www.argildx.us\/wp-json\/wp\/v2\/yst_prominent_words?post=4007"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}