cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to generate war for Alfresco and share using sdk4

venur
Star Contributor
Star Contributor

As the title, I tried generating war files from sdk 4 project of ours. But I couldn't get to it. Looks like we can only get amp or jar. 

we have a standalone machine where we setup acs 6 standalone and we have to deploy war files to the standlone server. 

can you help ?

1 ACCEPTED ANSWER

abhinavmishra14
World-Class Innovator
World-Class Innovator

By default SDK4 won't generate war files as far as i know. 

There is a discussion around this here: https://hub.alfresco.com/t5/alfresco-content-services-forum/how-to-generate-war-file-in-sdk-4-1/m-p/...

Since you are using standlone instances, you can choose to deploy your customization jar files under "module/share", "module/platform" as stated here: https://docs.alfresco.com/6.2/concepts/dev-extensions-packaging-techniques-jar-files.html   

or use alfresco mmt tool to apply amps if your customzations are in form of amp package. 

It is also possible to generate war files but requires some additonal changes to the maven project, its not available default. You can create two sub projects one for alfresco and one for share for overlaying the war files with your customizations. Include the war artifact dependency in the subprojects for acs and share respectively.  

In both sub projects you need to include maven-war-plugin.  For example in acs subproject:

 <dependencies>
    <!-- Get the original Alfresco Repo WAR artifact -->
    <dependency>
      <groupId>org.alfresco</groupId>
      <artifactId>content-services-community</artifactId>
       <version>6.2.0-ga</version>
       <type>war</type>
    </dependency>
    <!-- Include custom modules as dependencies -->
... </dependencies> <build> <finalName>alfresco</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <webResources> <resource> <targetPath>WEB-INF/classes/alfresco</targetPath> <directory>src/main/webapp/alfresco</directory> <filtering>false</filtering> </resource> </webResources> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.9</version> <configuration> <includes>com.github.abhinavmishra14*</includes> <excludes></excludes> <outputType>dot</outputType> </configuration> <executions> <execution> <id>unpack-amps</id> <phase>process-resources</phase> <goals> <goal>unpack-dependencies</goal> </goals> <configuration> <includeTypes>amp</includeTypes> <outputDirectory>${project.build.directory}/alfresco</outputDirectory> <excludes>META*</excludes> </configuration> </execution> </executions> <dependencies> <dependency> <groupId>org.alfresco.maven.plugin</groupId> <artifactId>maven-amp-plugin</artifactId> <version>3.0.4</version> </dependency> </dependencies> </plugin> <plugin> <groupId>org.alfresco.maven.plugin</groupId> <artifactId>alfresco-maven-plugin</artifactId> <version>3.0.1</version> <executions> <execution> <phase>none</phase> </execution> </executions> </plugin> <plugin> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-archiver</artifactId> <version>3.0</version> <executions> <execution> <phase>none</phase> </execution> </executions> </plugin> </plugins> </build>

Lastly, make sure you have allocated enough heap space for maven to build war files. Generally '1024m' works. See the additional info here: https://hub.alfresco.com/t5/alfresco-content-services-forum/im-having-trouble-assembling-war/td-p/29...

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

View answer in original post

3 REPLIES 3

abhinavmishra14
World-Class Innovator
World-Class Innovator

By default SDK4 won't generate war files as far as i know. 

There is a discussion around this here: https://hub.alfresco.com/t5/alfresco-content-services-forum/how-to-generate-war-file-in-sdk-4-1/m-p/...

Since you are using standlone instances, you can choose to deploy your customization jar files under "module/share", "module/platform" as stated here: https://docs.alfresco.com/6.2/concepts/dev-extensions-packaging-techniques-jar-files.html   

or use alfresco mmt tool to apply amps if your customzations are in form of amp package. 

It is also possible to generate war files but requires some additonal changes to the maven project, its not available default. You can create two sub projects one for alfresco and one for share for overlaying the war files with your customizations. Include the war artifact dependency in the subprojects for acs and share respectively.  

In both sub projects you need to include maven-war-plugin.  For example in acs subproject:

 <dependencies>
    <!-- Get the original Alfresco Repo WAR artifact -->
    <dependency>
      <groupId>org.alfresco</groupId>
      <artifactId>content-services-community</artifactId>
       <version>6.2.0-ga</version>
       <type>war</type>
    </dependency>
    <!-- Include custom modules as dependencies -->
... </dependencies> <build> <finalName>alfresco</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <webResources> <resource> <targetPath>WEB-INF/classes/alfresco</targetPath> <directory>src/main/webapp/alfresco</directory> <filtering>false</filtering> </resource> </webResources> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.9</version> <configuration> <includes>com.github.abhinavmishra14*</includes> <excludes></excludes> <outputType>dot</outputType> </configuration> <executions> <execution> <id>unpack-amps</id> <phase>process-resources</phase> <goals> <goal>unpack-dependencies</goal> </goals> <configuration> <includeTypes>amp</includeTypes> <outputDirectory>${project.build.directory}/alfresco</outputDirectory> <excludes>META*</excludes> </configuration> </execution> </executions> <dependencies> <dependency> <groupId>org.alfresco.maven.plugin</groupId> <artifactId>maven-amp-plugin</artifactId> <version>3.0.4</version> </dependency> </dependencies> </plugin> <plugin> <groupId>org.alfresco.maven.plugin</groupId> <artifactId>alfresco-maven-plugin</artifactId> <version>3.0.1</version> <executions> <execution> <phase>none</phase> </execution> </executions> </plugin> <plugin> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-archiver</artifactId> <version>3.0</version> <executions> <execution> <phase>none</phase> </execution> </executions> </plugin> </plugins> </build>

Lastly, make sure you have allocated enough heap space for maven to build war files. Generally '1024m' works. See the additional info here: https://hub.alfresco.com/t5/alfresco-content-services-forum/im-having-trouble-assembling-war/td-p/29...

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

Worked!! Thnx for hint

EddieMay
World-Class Innovator
World-Class Innovator

Hi @venur 

Thanks for accepting the solution - helpful to other uses to see what worked.

Cheers,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!