Mule Cloud Connector未使用Mule Devkit 3.4和JDK7进行编译

时间:2013-05-22 16:30:00

标签: cloud mule java-7 connector

我使用Mule 3.3.0和JDK7构建了一个自定义云连接器,一切正常。当更新到Mule 3.4.0时,我遇到了传递@Processor函数List参数的问题。

@Processor
public String myProcessor(String content)
{
    return content;
}

这个编译很好,但是这个

@Processor
public String myProcessor(List<String> content)
{
    return "content";
}

引发以下错误:

[ERROR] Failed to execute goal org.mule.tools.devkit:mule-devkit-maven-plugin:3.4.0:generate-sources (default-generate-sources) on project enterprise-message-adapter: java.lang.InstantiationError: com.sun.tools.javac.util.Name$Table -> [Help 1]

如果我将我的JAVA_HOME更改为1.6,这可以正常工作。我尝试过使用maven-compiler-plugin,但无济于事。

2 个答案:

答案 0 :(得分:4)

这是DevKit的众所周知的限制:现在你必须使用JDK6来编译你的项目。

我不确定您是否可以查看JIRA:http://www.mulesoft.org/jira/browse/DEVKIT-261但如果是,请向上投票!

答案 1 :(得分:1)

我能够使用不同的Mule组件版本(包括devkit 3.4.3)在OS X上使用它。这可能会导致其他人的问题,但我能够使用Mule 3.4.0 CE运行时和JDK™7成功创建,打包和部署Anypoint连接器,并使用下面列出的pom声明。

这适用于当前版本的Anypoint Studio和Maven。

<dependencies>
  <dependency>
    <artifactId>core</artifactId>
    <groupId>org.osgi</groupId>
    <version>[4.3.0]</version>
    <scope>provided</scope>
  </dependency>
  <dependency>
    <artifactId>eclipse-runtime</artifactId>
    <groupId>org.eclipse</groupId>
    <version>[3.6.0.v20100505]</version>
    <scope>provided</scope>
  </dependency>
  <dependency>
    <artifactId>dom4j</artifactId>
    <groupId>dom4j</groupId>
    <version>1.6.1</version>
  </dependency>
  <dependency>
    <groupId>org.mule.common</groupId>
    <artifactId>mule-common</artifactId>
    <version>3.4.2</version>
    <scope>provided</scope>
  </dependency>
  <dependency>
    <groupId>org.mule.modules</groupId>
    <artifactId>mule-module-devkit-support</artifactId>
    <version>3.4.3-SNAPSHOT</version>
  </dependency>
  <dependency>
    <groupId>org.mule.tools.devkit</groupId>
    <artifactId>mule-devkit-annotations</artifactId>
    <version>3.4.3</version>
  </dependency>
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-beans</artifactId>
    <version>3.2.1.RELEASE</version>
  </dependency>
  <dependency>
    <groupId>org.mule.modules</groupId>
    <artifactId>mule-module-spring-config</artifactId>
    <version>3.4.0</version>
  </dependency>
  <dependency>
    <groupId>eclipse</groupId>
    <artifactId>eclipse-runtime</artifactId>
    <version>2.1.0</version>
    <scope>provided</scope>
  </dependency>
  <dependency>
    <artifactId>eclipse-workbench</artifactId>
    <groupId>org.eclipse</groupId>
    <version>[3.6.1.M20100826-1330]</version>
    <scope>provided</scope>
  </dependency>
</dependencies>
<repositories>
  <repository>
    <id>mulesoft-releases</id>
    <name>MuleSoft Releases Repository</name>
    <url>http://repository.mulesoft.org/releases/</url>
    <layout>default</layout>
  </repository>
  <repository>
    <id>mulesoft-snapshots</id>
    <name>MuleSoft Snapshots Repository</name>
    <url>http://repository.mulesoft.org/snapshots/</url>
    <layout>default</layout>
  </repository>
</repositories>
<build>
  <pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.mule.tools.devkit</groupId>
        <artifactId>mule-devkit-maven-plugin</artifactId>
        <version>3.4.3</version>
        <extensions>true</extensions>
      </plugin>
      <plugin>
        <groupId>org.eclipse.m2e</groupId>
        <artifactId>lifecycle-mapping</artifactId>
        <version>1.0.0</version>
        <configuration>
          <lifecycleMappingMetadata>
            <pluginExecutions>
              <pluginExecution>
                <pluginExecutionFilter>
                  <groupId>org.mule.tools.devkit</groupId>
                  <artifactId>mule-devkit-maven-plugin</artifactId>
                  <versionRange>[2.0,)</versionRange>
                  <goals>
                    <goal>attach-test-resources</goal>
                    <goal>filter-resources</goal>
                    <goal>generate-sources</goal>
                  </goals>
                </pluginExecutionFilter>
                <action>
                  <ignore />
                </action>
              </pluginExecution>
            </pluginExecutions>
          </lifecycleMappingMetadata>
        </configuration>
      </plugin>
    </plugins>
  </pluginManagement>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>2.5</version>
      <executions>
        <execution>
          <id>default-compile</id>
          <configuration>
            <compilerArgument>-proc:none</compilerArgument>
            <source>1.7</source>
            <target>1.7</target>
          </configuration>
        </execution>
        <execution>
          <id>default-testCompile</id>
          <configuration>
            <compilerArgument>-proc:none</compilerArgument>
            <source>1.7</source>
            <target>1.7</target>
          </configuration>
        </execution>
      </executions>
    </plugin>
    <plugin>
      <groupId>org.mule.tools.devkit</groupId>
      <artifactId>mule-devkit-maven-plugin</artifactId>
      <version>3.4.3</version>
    </plugin>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-enforcer-plugin</artifactId>
      <version>1.0-alpha-4</version>
      <executions>
        <execution>
          <id>enforce-maven-version</id>
          <goals>
            <goal>enforce</goal>
          </goals>
          <configuration>
            <rules>
              <requireMavenVersion>
                <version>[3.0.0,)</version>
              </requireMavenVersion>
              <requireJavaVersion>
                <version>[1.6.0,)</version>
              </requireJavaVersion>
            </rules>
          </configuration>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>