maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Zeleznik" <dzelez...@ilog.com>
Subject JBuilder Plugin
Date Tue, 25 Mar 2003 22:50:36 GMT
Hi,

We are a heavy user of both JBuilder and IDEA and have found that the
current JBuilder plugin is much less functional than the IDEA plugin for
generating project files. I have started working on improving the
jbuilder:generate-project goal, but would like to know if anyone else is
working in this area. I will be happy to send my changes to the list if
anyone is interested. I just do not want to conflict if there is active
development on this plugin.

As to the jbuilder:generate-library goal, this one seems completely broken
and actually generates circular references. I am not sure what the original
developer had in mind. My idea is to generate library files directly into
the user's jbuilder home directory where they can then be referenced by the
generated JBuilder projects and other libraries. If a person does
generate-project and some of the projects dependencies do not have library
files created yet, a default library definition will be created that simply
references the jar in the local repo. The user can then override this
default library definition by going to the dependency project and doing
generate-library. This will generate a library definition that includes the
source code. I am also planning to generate versioned library definitions,
rather than just using the artifactId like the current plugin does.

I have attached my first rough draft of my generate-project improvements.
Note, that handling of the project dependencies and libraries is not
implemented yet. It is next on my todo list.

  <goal
    name="jbuilder:generate-project"
    description="Generate JBuilder [id_project].jpx file">

    <!-- This forces the javadoc plugin to load and read its properties -->
    <attainGoal name="maven-javadoc-plugin:register" />

    <echo>Creating ${basedir}/${pom.artifactId}.jpx ...</echo>

    <!-- Initialize default values for project properties. If we find a
default
         JBuilder project, then its values will override some of these. -->
    <j:set var="authorLabel"      value="@author" />
    <j:set var="backupPath"       value="bak" />
    <j:set var="beansInstantiate" value="false" />
    <j:set var="company"          value="${pom.organization.name}" />
    <j:set var="companyLabel"     value="Company: " />
    <j:set var="copyrightLabel"   value="Copyright: " />
    <j:set var="descriptionLabel" value="Description: " />
    <j:set var="docPath"
value="${pom.getPluginContext('maven-javadoc-plugin').getVariable('maven.jav
adoc.destdir')}" />
    <j:set var="includeTestPath"  value="1" />
    <j:set var="jdk"              value="java ${java.vm.version}" />
    <j:set var="titleLabel"       value="Title: " />
    <j:set var="versionLabel"     value="@version" />
    <j:set var="workingDir"       value="." />

    <!-- Format the year. -->
    <tstamp>
       <format property="currentYear" pattern="yyyy" />
    </tstamp>
    <tstamp>
      <j:choose>
        <j:when test="${pom.inceptionYear.equals(currentYear)}">
          <format property="year" pattern="yyyy"/>
        </j:when>
        <j:otherwise>
          <format property="year" pattern="${pom.inceptionYear}-yyyy"/>
        </j:otherwise>
      </j:choose>
    </tstamp>

    <!-- Find and read the JBuilder default project properties. -->
    <j:set var="jbuilderDirs"
value=".jbuilder8,.jbuilder7,.jbuilder6,.jbuilder5,.jbuilder4,.jbuilder" />
    <u:tokenize var="jbuilderDirList" delim=",">${jbuilderDirs}</u:tokenize>
    <j:forEach var="dir" items="${jbuilderDirList}">
      <j:set var="jbUserHome" value="${user.home}/${dir}" />
      <j:set var="defaultProject" value="${jbUserHome}/Default.jpr" />
      <u:available file="${defaultProject}">
        <j:set var="jbDefaultProject" value="${defaultProject}" />
        <j:break/>
      </u:available>
    </j:forEach>
    <j:if test="${jbDefaultProject == null}" >

<echo>+------------------------------------------------------------------</e
cho>
      <echo>| WARNING!</echo>
      <echo>|</echo>
      <echo>| A JBuilder installation could not be found. The project
files</echo>
      <echo>| being created will contain default values.</echo>

<echo>+------------------------------------------------------------------</e
cho>
    </j:if>
    <j:if test="${jbDefaultProject != null}" >
      <echo>Reading default project ${jbDefaultProject}</echo>
      <u:properties file="${jbDefaultProject}" var="defaultProps" />
      <j:set var="authorLabel"
value="${defaultProps.getProperty('sys[0].AuthorLabel')}" />
      <j:set var="backupPath"
value="${defaultProps.getProperty('sys[0].BackupPath')}" />
      <j:set var="backupPath"       value="${backupPath.replaceAll('%%\|',
':')}" />
      <j:set var="beansInstantiate"
value="${defaultProps.getProperty('sys[0].BeansInstantiate')}" />
      <j:set var="companyLabel"
value="${defaultProps.getProperty('sys[0].CompanyLabel')}" />
      <j:set var="copyrightLabel"
value="${defaultProps.getProperty('sys[0].CopyrightLabel')}" />
      <j:set var="descriptionLabel"
value="${defaultProps.getProperty('sys[0].DescriptionLabel')}" />
      <j:set var="titleLabel"
value="${defaultProps.getProperty('sys[0].TitleLabel')}" />
      <j:set var="versionLabel"
value="${defaultProps.getProperty('sys[0].VersionLabel')}" />
      <available property="jdkDefPresent"
file="${jbUserHome}/${jdk}.library" />
      <j:if test="${!jdkDefPresent}">

<echo>+------------------------------------------------------------------</e
cho>
        <echo>| WARNING!</echo>
        <echo>|</echo>
        <echo>| This project is being configured to use ${jdk}. This</echo>
        <echo>| JDK has not been configured yet in your JBuilder
installation.</echo>
        <echo>| Go to Tools|Configure JDKs.</echo>

<echo>+------------------------------------------------------------------</e
cho>
      </j:if>
    </j:if>

    <!-- Format the copyright notice. -->
    <j:set var="copyright" value="Copyright (c) ${year} ${company} - All
Rights Reserved." />

	  <j:file name="${basedir}/${pom.artifactId}.jpx" prettyPrint="true"
xmlns="dummy">
  	  <project>
  	    <x:comment>JBuilder XML Project</x:comment>
        <property category="sys" name="Author"
value="${maven.username}" />
    	  <property category="sys" name="AuthorLabel"
value="${authorLabel}" />
        <property category="sys" name="BackupPath"
value="${backupPath}" />
        <property category="sys" name="BeansInstantiate"
value="${beansInstantiate}" />
        <property category="sys" name="Company"          value="${company}"
/>
    	  <property category="sys" name="CompanyLabel"
value="${companyLabel}" />
        <property category="sys" name="Copyright"
value="${copyright}" />
        <property category="sys" name="CopyrightLabel"
value="${copyrightLabel}" />
        <property category="sys" name="DefaultPath"
value="${pom.build.sourceDirectory}" />
        <property category="sys" name="Description"
value="${pom.shortDescription}" />
        <property category="sys" name="DescriptionLabel"
value="${descriptionLabel}" />
        <property category="sys" name="DocPath"          value="${docPath}"
/>
        <property category="sys" name="IncludeTestPath"
value="${includeTestPath}" />
        <property category="sys" name="JDK"              value="${jdk}" />
        <property category="sys" name="Libraries"
value="${libraries}" />
        <property category="sys" name="OutPath"
value="${maven.build.dest}" />
    	  <property category="sys" name="SourcePath"
value="${pom.build.sourceDirectory};${pom.build.unitTestSourceDirectory}" />
    	  <property category="sys" name="TestPath"
value="${pom.build.unitTestSourceDirectory}" />
        <property category="sys" name="Title"            value="${pom.name}"
/>
        <property category="sys" name="TitleLabel"
value="${titleLabel}" />
    	  <property category="sys" name="Version"
value="${pom.currentVersion}" />
    	  <property category="sys" name="VersionLabel"
value="${versionLabel}" />
    	  <property category="sys" name="WorkingDirectory"
value="${workingDir}" />
  	  </project>
  	</j:file>
  </goal>

I would be interested in any feedback from others using both Maven and
JBuilder on the same projects.

--------------------------------------
David Zeleznik
ILOG - Changing the rules of business
mailto:dzeleznik@ilog.com
http://www.ilog.com
--------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message