How to run the Mule export studio equivalent in a script?

I need to create a deployable ZIP archive from a script, just like the Export function in Mule Studio. I expect that ZIP will contain everything needed to deploy the application: JAR files, message streams, etc. Etc. - again, as Mule Studio Export does.

Is there an easy way to do this or an example that I can follow?

+4
source share
2 answers

Maven is your best bet. Using the mule plugin for maven runnning mvn packagewill create a deployed archive. More information about Mule and Maven here: http://www.mulesoft.org/documentation/display/current/Using+Maven+with+Mule

ant, . : http://blogs.mulesoft.org/building-mule-apps-with-ant/

: http://www.mulesoft.org/documentation/display/current/Application+Format, . Maven.

+4

Maven jar/zip Mule... , MULE_HOME ... Maven Script Jar/Zip Mule Standalone: ​​-

     <build>
    <resources>
          <resource>
            <directory>>${project.basedir}/lib</directory>
            <filtering>true</filtering>
          </resource>
        </resources>


            <pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-install-plugin</artifactId>
                        <version>2.3.1</version>
                    </plugin>
                </plugins>
            </pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.mule.tools</groupId>
                    <artifactId>maven-mule-plugin</artifactId>
                    <version>1.6</version>
                    <extensions>true</extensions>
                    <configuration> <!-- This tag sets true/false to copy jar/zip file to Mule server app folder --> 
                        <copyToAppsDirectory>true</copyToAppsDirectory>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.2</version>
                    <configuration>
                        <source>1.6</source>
                        <target>1.6</target>
                        <encoding>ISO-8859-1</encoding>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <configuration>
                        <finalName>YOUR_APPPLICATION_NAME</finalName>
                        <descriptors>
                            <descriptor>assembly.xml</descriptor>
                        </descriptors>
                        <appendAssemblyId>true</appendAssemblyId>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-eclipse-plugin</artifactId>
                    <version>${eclipsePluginVersion}</version>
                    <configuration>
                        <!-- by default download all sources when generating project files -->
                        <downloadSources>true</downloadSources>
                        <classpathContainers>
                            <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER/${vmtype}/${jdkName}
                            </classpathContainer>
                        </classpathContainers>
                    </configuration>
                </plugin>

        <!--
                    make sure that MULE_HOME is set when building (required below when copying the
                    artifact to Mule apps directory
                -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>1.0-beta-1</version>
                    <executions>
                        <execution>
                            <phase>install</phase>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <requireProperty>
                                        <property>env.MULE_HOME</property>
                                        <message>You must set MULE_HOME before installing the example.</message>
                                    </requireProperty>
                                </rules>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>


        <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.4</version>
                        <executions>
                            <execution>
                                <id>package-example</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
<!-- This tag automatically deploy jar/zip file to server -->
                                        <copy file="${project.build.directory}/${project.build.finalName}.zip"
                                            todir="${env.MULE_HOME}/apps" overwrite="true"/>
                                    </tasks>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
+2

Source: https://habr.com/ru/post/1548268/


All Articles