Java jarã®ããã¯ããŒã ãexeãã¡ã€ã«ã§ã©ããããããšãã«é¢çœãããšãèµ·ããå§ããŸãããã©ããããããã³ãŠã¢ãªã®ããã¯ããŒã ãããèŠãæ¹ãããã£ãã§ãïŒã¢ã€ã³ã³ããã蟌ãããšãã§ããå Žåã®ã¿ïŒãã³ããŒãããŠããããã¹ãŠãã¢ãŒã«ã€ãã«åéããã次ã«ããŒãžã§ã³çªå·ãã¢ãŒã«ã€ãã®ååã«å«ãŸããããã«ãªãããã®åŸ...ããã³...äžè¬ã«éå§ãããŸããã ãããã®ãŠã£ãã·ã¥ãªã¹ãã¯æçµçã«èªè»¢è»ãèšè¿°ããç§ã®èªè»¢è»ã®ååãšããŠãããžã§ã¯ãåã«ãã«ããŒãã¬ãã£ãã¯ã¹ãè¿œå ãããã¹ãŠã®äœæ¥ãè¡ãå°ããªã³ãŒããèšè¿°ããŸããïŒNetBeansããããžã§ã¯ããæ§ç¯ããããšã¯äºå®ã§ãïŒã ãããŠããã©ãŒã«ã€ããŠã®ããŒãžã§ã³çªå·ã¯ãäžè¬çã«ãœãŒã¹ã®ã©ããã«ããæååå®æ°ããåŒãåºãããŸããã ãã¡ãããç§ã®ããŒã«ã¯æ®éçãªãµããããŠããããäžèšã®ãŠã£ãã·ã¥ãªã¹ãã¯ä»ã®ãããžã§ã¯ãã§ããã«ç¹°ãè¿ãããããšãçŽæããŸããã
ãããŠãç§ã¯Mavenã«äŒããŸããã ãããã·ã¢èªã®ãªãœãŒã¹ã§èª€ã£ãŠããã«ã€ããŠèªãã ã®ã§ããã圌ãç§ã®åé¡ã解決ããããšã«æ°ã¥ããŸãããã圌ã¯ããããªã䜿ãã®ãããªããã€ã¯ãã¯ãŒã«ã§ã¯ãªãã®ããå®å šã«ã¯ç解ããŠããŸããã§ãããïŒ ç§ãã€ã³ã¿ãŒãããã§ãã©ãŒã©ã ã調ã¹ããšããã圌ãã説æããã説æãããããçš®ã®çŽåŸãããã®ãšåãç解ã§ããªããã©ãŒã©ã ãèŠã€ãã£ãã ç§ã®è±èªã®ç¥èãèæ ®ã«å ¥ããŠãç 究ã¯å°é£ã§å§ãŸãããã¹ãŠã®ææžã¯ãã®èšèªã§æžãããŠããŸãã Haberã®èšäºã¯å€§ãã«åœ¹ç«ã¡ãŸãããApacheMaven- åºæ¬ãšMaven-ãããžã§ã¯ãã¢ã»ã³ããªã®èªåå ã æ£ããå€æãäžãæåŸã®ã¹ãããŒã¯ãMercurialãªããžããªããã¯ããŒã³åãããJavaãããžã§ã¯ãã®ã©ã€ãã©ãªãåãªã³ã¯ããæ¹æ³ãæãåºãããšã§ããã ãŸããå°ãªããšããããã¯ã»ãšãã©ãªãã以åã®ãããžã§ã¯ãã®éçºè ã¯å察ã«åº§ã£ãŠããŸãããå°ããããšãã§ããŸã:)ã
ã ãããç§ã®ç®ã®åã«ã¯ç®æšããããŸããïŒãã¹ãŠãçŸããè¡ãããªããã°ãªããªãã®ã§ããã¹ãŠãç§ã®ããã«è¡ã£ãŠããŸãã:)ãããŠæ ã¯ã圌ããèšãããã«ãé²æ©ã®ãšã³ãžã³ã§ãã ãã®çµæã次ã®ã¿ã¹ã¯ã圢æãããŸããã
-NetBeansïŒãã¹ãŠã®ã©ã€ãã©ãªãå«ãïŒã®ãããªãããžã§ã¯ãå šäœã®ã¢ã»ã³ããªã
-ã³ãŒãã«ç»ãå¿ èŠã®ãªãã¢ã»ã³ããªã®çªå·ä»ãã®èªååã
-exeãã¡ã€ã«ã§jarãã©ããã
-Mercurialãªããžããªãšã®åæïŒäžè¬ã«ãã³ãããçªå·ã«åºã¥ããŠã¢ã»ã³ããªãäœæãããã£ãïŒã
幞ããªããšã«ãNetBeansã®MavenãµããŒãã¯ããã«äœ¿çšã§ããŸãã
-ãŠãŒã¶ãŒããã¥ã¡ã³ããšãã®ä»ã®å¿ èŠãªãã¡ã€ã«ïŒããšãã°ãjarã¢ãŒã«ã€ãå€ã®.propertiesãã¡ã€ã«ïŒãè¿œå ããŸãã
ãNetBeansã®ãããªããšããæŠå¿µã«å«ãŸãããã®ïŒãã¹ãŠã®ãªãœãŒã¹ïŒã€ã¡ãŒãžã.propertiesãã¡ã€ã«ïŒãã³ããŒããé¢é£ãããã¹ãŠã®ã©ã€ãã©ãªããã«ã¢ãããããããã§ã¹ãã«å¿ èŠãªæ å ±ãæžã蟌ã¿ãŸãã ããã©ã«ãã§ã¯ãmavenã¯.classãã¡ã€ã«ã®ã¿ãåéããjarã¢ãŒã«ã€ãã«ã¯ãã以äžãåéããããããã§ã¹ãã¯ãããã§ãã
ãã®èšäºã§ã¯ããããžã§ã¯ãã®ã©ã€ããµã€ã¯ã«ã®ãã§ãŒãºã«ã€ããŠã¯èª¬æããŸããã ãã«ãã©ã€ããµã€ã¯ã«ã®æŠèŠãšäžèšã®èšäºãã芧ãã ããã
ãã®ããããããžã§ã¯ãã®ã¢ã»ã³ããªã«é¢ãããã¹ãŠã®æ å ±ãpom.xmlãã¡ã€ã«ã«æ ŒçŽãããŠããããšã¯ãç§ãã¡å šå¡ïŒãã¡ãããç§ã¯æ¢ã«èª¬æããŠããŸã:)ïŒãç¥ã£ãŠããŸãã äŸåé¢ä¿ïŒãããžã§ã¯ããšãã©ã°ã€ã³ã®ã¢ãŒãã£ãã¡ã¯ãïŒãããã³ãããã®ãã©ã°ã€ã³ã®æ§æãäœãã©ã®ããã«è¡ãããã©ãã«çœ®ãããå®è¡ããä»ã®æäœããããŸãã åãã©ã°ã€ã³ã¯ããã®<plugin />ã¿ã°ã§ããã¡ãããããŒãžã§ã³ãååãã©ã€ããµã€ã¯ã«ãã§ãŒãºã瀺ãããã«æ§æãããŠããŸãã ãã¹ãŠã®æ§æã¯ããããžã§ã¯ãå šäœã®ãã«ããæ åœãã<build />ã¿ã°å ã®å ±éã®<plugins />ã¿ã°ã«é 眮ãããŸããã
ãã€ã³ããèŠãŠã¿ãŸãããã
NetBeansã®ãããªãããžã§ã¯ããæ§ç¯ãã
ããã«å«ãŸãããã®ã¯äœã§ããïŒ ããããã§ã«æ±ºå®ããŸããïŒsrcãã£ã¬ã¯ããªãããã¹ãŠã®ãªãœãŒã¹ãã³ããŒãïŒãœãŒã¹ããããŸãïŒããã¹ãŠã®äŸåé¢ä¿ãã¿ãŒã²ãããã£ã¬ã¯ããªïŒã¿ãŒã²ããïŒã«ã³ããŒãããããã§ã¹ãã«æ å ±ãè¿œå ããŸãã
ãã¹ãŠã®äŸåé¢ä¿ã®ã³ããŒã¯ãèšå®ã®äžã®maven-dependency-pluginãã©ã°ã€ã³ã«ãã£ãŠå®è¡ãããŸããã
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <configuration> <outputDirectory>${project.build.directory}/lib/</outputDirectory> <overWriteReleases>false</overWriteReleases> <overWriteSnapshots>false</overWriteSnapshots> <overWriteIfNewer>true</overWriteIfNewer> </configuration> <executions> <execution> <id>copy-dependencies</id> <phase>package</phase> <goals> <goal>copy-dependencies</goal> </goals> </execution> </executions> </plugin>
ãããã¯ãã¹ãŠïŒNetBeansã®ããã«ïŒlibãã£ã¬ã¯ããªã«è¿œå ãããããšã«æ³šæããŠãã ãã:)ã åæã«ãã©ã€ãã©ãªãæ°ããããŒãžã§ã³ã§äžæžãããçŸåšã®ããŒãžã§ã³ãäžæžããããæçµããŒãžã§ã³ãªãã§äŸåé¢ä¿ãäžæžãããªãããšã瀺ããŸãïŒã¹ãããã·ã§ããïŒã ãŸããæäœãé²è¡äžã®ãã§ãŒãºïŒããã±ãŒãžïŒã瀺ããŸãã ååãšããŠãã²ã¹ããæ¥ãŠãéãã¯ãããŸããã
ãããã§ã¹ãã®æ å ±ã¯æ¬¡ã®ããã«è¿œå ãããŸããã
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <classpathPrefix>lib/</classpathPrefix> <classpathLayoutType>simple</classpathLayoutType> <mainClass>com.khmb.block_v2.Block_v2App</mainClass> </manifest> <manifestEntries> <Version>${buildNumber}</Version> </manifestEntries> </archive> </configuration> </plugin>
<classpathPrefix />ã¿ã°ã¯ãã©ã€ãã©ãªãlibãã£ã¬ã¯ããªãããã«ãããŠããããšã瀺ããŠããŸãã åçŽãªå€ãæã€<classpathLayoutType />ã¿ã°ã¯ãjar-nicksã1ã€ã®ããŒãã§ã¹ããŒãããããšãã³ã¬ã¯ã¿ãŒã«äŒããŸãã ãªããžããªã®å€ããããã©ã€ãã©ãªã¯mavenãªããžããªã®ããã«è¿œå ãããŸãã ããã±ãŒãžãããŒãžã§ã³ãã©ã€ãã©ãªåã®ååãæã€ãã¹ãŠã®ãµããã£ã¬ã¯ããªã
以äžã§èª¬æããå€æ°$ {buildNumber}ã«æ³šç®ãã䟡å€ããããŸãã
äŸåé¢ä¿ã«å ããŠããããã§ã¹ãã¯ããã°ã©ã ã®èµ·åå ã®ã¯ã©ã¹ã瀺ããŸãã
䜿çšããããã©ã°ã€ã³ã®ãã¹ãŠã®ãã©ã¡ãŒã¿ãŒã®èª¬æã¯ã Maven JAR pluginã«ãããŸããå€ãã®èå³æ·±ãããšããããŸãã
次ã«ãjarã¢ãŒã«ã€ãã«ã¢ã»ã³ãã«ããåã«ããã¹ãŠã®ãªãœãŒã¹ïŒç»åããã³.propertiesãã¡ã€ã«ïŒããã³ã³ãã€ã«ããã.classãã¡ã€ã«ã®ãããã£ã¬ã¯ããªã«ããããããå¿ èŠããããŸããã
<plugin> <artifactId>maven-resources-plugin</artifactId> <version>2.5</version> <executions> <execution> <id>copy-resources</id> <phase>validate</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${project.build.outputDirectory}/com/khmb/${project.name}</outputDirectory> <resources> <resource> <directory>${project.build.sourceDirectory}/com/khmb/${project.name}</directory> <filtering>true</filtering> <includes> <include>**/*.properties</include> </includes> </resource> <resource> <directory>${project.build.sourceDirectory}/com/khmb/${project.name}</directory> <includes> <include>**/*.png</include> </includes> </resource> </resources> </configuration> </execution> </executions> </plugin>
ããªãããŒãªã³ããŒã§ã¯ãªããMavenã«ãã¹ãŠãæ£ç¢ºã«åãããã«é 眮ããããã«äŸé ŒããŠãã ããã ãã ãã1ã€ã®ç¹æ®æ§ããããŸããPNGãã¡ã€ã«ïŒããã³ãããžã§ã¯ãããã®åœ¢åŒã®ç»åã®ã¿ã䜿çšããïŒããã®ããã«ã³ããŒãããå Žåã.priopertiesãã¡ã€ã«ã¯ãã£ã«ã¿ãªã³ã°ãã€ãŸãã³ããŒãããŸãã ãã©ã°ã€ã³ã¯ãããã®å éšã調ã¹ãmavenã®å€æ°ã§äœãã眮ãæããå¿ èŠãããå Žåãããã眮ãæããŸãã ããã¯ãã¿ã°ãã©ã¡ãŒã¿ãŒ<filtering />-trueã«ãã£ãŠç€ºãããŸãã ãªãœãŒã¹ãç°ãªã<resource />ã¿ã°ã«åºåãããŠããã®ã¯ãã®ããã§ã-åçããã£ã«ã¿ãŒããŠãæå³ããããŸããã
ãããžã§ã¯ãã®ã³ã³ãã€ã«ã¯ã次ã®ãã©ã°ã€ã³ã«ãã£ãŠèŠå¶ãããŠããŸãã
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>${jdkVersion}</source> <target>${jdkVersion}</target> </configuration> </plugin>
å€æ°$ {jdkVersion}ã«ã€ããŠã¯å°ãåŸã§èª¬æããŸãã
ã³ãŒãã«å ¥ããã«ã¢ã»ã³ããªã®çªå·ä»ããèªååãã
ãããŠããããã®.propertiesãã¡ã€ã«ã®äžã«ã¯äœããããŸããïŒ ãã¹ãŠãéåžžã«åçŽã§ãããã®ãã¡ã®1ã€ã«ãã¢ããªã±ãŒã·ã§ã³ã®ããŒãžã§ã³çªå·ããããŸããããã¯ãå®è¡æã«æ¡å€§ãããã®ã¢ããªã±ãŒã·ã§ã³ã«é¢ããæ å ±ïŒããããïŒãšãšãã«ãŠã£ã³ããŠã«è¡šç€ºãããŸãã
Application.version = ${buildNumber}
ãããŠããã®ãã«ãçªå·ã¯ã©ãããæ¥ãã®ã§ããïŒ åœŒã¯buildnumber-maven-pluginãã©ã°ã€ã³ã®ãããã§ãã ãã©ã°ã€ã³ã®åœ¹å²ã¯ã絶察ã«ä»»æã®ããŒãžã§ã³çªå·ãäœæããããšã§ãã ããã°ã©ã ã®ããŒãžã§ã³çªå·ïŒãŸãã¯ã¢ãŒãã£ãã¡ã¯ãïŒãšãã«ãæ¥ä»ãå«ããããšã«ããŸããã
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>buildnumber-maven-plugin</artifactId> <version>1.0</version> <configuration> <format>{0}-{1,date,yyyyMMdd}</format> <items> <item>${project.version}</item> <item>timestamp</item> </items> <doCheck>true</doCheck> <doUpdate>true</doUpdate> </configuration> <executions> <execution> <phase>validate</phase> <goals> <goal>create</goal> </goals> </execution> </executions> </plugin>
ããŒãžã§ã³çªå·ã¯ããã€ãã®éšåïŒ<format />ã¿ã°ïŒããçµã¿ç«ãŠãããåéšåã¯äžæ¬åŒ§ã§å²ãŸããJavaèšèªã®MessageFormatã®èšè¿°ã«åŸã£ãŠåœ¢æãããŸãã åéšåã«ã¯ã眮æããå€ã瀺ã<item />ã¿ã°ããããŸãã ã¡ãªã¿ã«ããbuildNumberããšããããã¹ããæ¿å ¥ã§ããŸããã¢ã»ã³ããªäžã«ããããžã§ã¯ããã£ã¬ã¯ããªã®ã«ãŒãã«ãã®ã¢ã»ã³ããªã®çªå·ãçæããããã³ã«ã®ã¿ïŒå€ã¯buildNumber.propertiesãã¡ã€ã«ã«ä¿åãããŸãïŒã ç§ãæåŠããã®ã¯ãããã°ã©ã ã®æäœæ§ãäœåå®è¡ããå¿ èŠãããããåžžã«ãã§ãã¯ããŠããããããã®æ°ãéåžžã«å€§ãããªãå¯èœæ§ãããããã§ãã
exeãã¡ã€ã«ã§jarãã©ãããã
ç§ã®èªè»¢è»ã®æ代ã«ãç§ã¯è¯ãlaunch4jããã°ã©ã ã«åºäŒããŸãããããã¯ãjarãexeã§ã©ããããã ãã§ãªããã¢ããªã±ãŒã·ã§ã³ã«ã¢ã€ã³ã³ãè¿œå ããããšãã§ããŸããïŒãäœæè ãããŒãžã§ã³ãªã©ã«é¢ããæ å ±ã¯ãã©ã®ããŒãžã§ã³ã®jreã䜿çšããã¹ãããã©ããåç §ãããã瀺ããŸãïŒããŒã¿ãã«ããŒãžã§ã³ãæºåž¯ããããšãã§ããŸãïŒããäžè¬çã«ã¯ãã£ãšå€ãã®ããšãã§ããŸãã ãã¹ãŠã®èšå®ã¯xmlãã¡ã€ã«ã«ä¿åããããã®èª¬æã¯ããã°ã©ã ã®Webãµã€ãã«ãããŸãã ãã®xmlãã¡ã€ã«ãèªè»¢è»ã§çæãããã®ãã¹ããã©ã¡ãŒã¿ãŒãšããŠåŒã³åºãããlaunch4j.exeã«æž¡ããŸããã åºåã«exeãã¡ã€ã«ããããããã¯äŸåé¢ä¿ãšãã®jarã«ãŠã³ã¿ãŒããŒãã«é¢é£ä»ããããŠããŸãïŒã€ãŸããç¹å¥ãªãã©ã¡ãŒã¿ãŒãæå®ãããŠããªãéããåãäŸåé¢ä¿ãåç §ããŠããã¯ãã§ãïŒã ãã®äŸ¿å©ãªããã°ã©ã ãMavenãã©ã°ã€ã³ãšããŠãååšããããšã¯ãç§ã®å¹žãã§ããã ãã©ã°ã€ã³ã®æ§æã¯ãããã§èŠãããšãã§ããããã€ãã®æ©èœãé€ããŠããã®å€ãå åŒããã°ã©ã ãšã»ãŒå®å šã«äžè²«ããŠããŸãã ãšããã§ãWindowsã ãã§ãªãLinuxã§ããã€ããªãåéã§ããŸãã 以äžã¯ç§ã®èšå®ã§ãã
<plugin> <groupId>com.akathist.maven.plugins.launch4j</groupId> <artifactId>launch4j-maven-plugin</artifactId> <executions> <execution> <id>l4j-clui</id> <phase>package</phase> <goals> <goal>launch4j</goal> </goals> <configuration> <headerType>gui</headerType> <outfile>target/${exeFileName}.exe</outfile> <jar>target/${project.artifactId}-${project.version}.jar</jar> <errTitle>${product.title}</errTitle> <icon>favicon.ico</icon> <classPath> <mainClass>com.khmb.block_v2.Block_v2App</mainClass> <addDependencies>true</addDependencies> <preCp>anything</preCp> </classPath> <jre> <minVersion>${jdkVersion}.0</minVersion> </jre> <versionInfo> <fileVersion>${project.version}.0</fileVersion> <txtFileVersion>${project.version}</txtFileVersion> <fileDescription> </fileDescription> <copyright>Copyright © 2011 ${product.company}</copyright> <productVersion>${project.version}.0</productVersion> <txtProductVersion>${project.version}</txtProductVersion> <companyName>${product.company}</companyName> <productName>${product.title}</productName> <internalName>${exeFileName}</internalName> <originalFilename>${exeFileName}.exe</originalFilename> </versionInfo> </configuration> </execution> </executions> </plugin>
䜿çšããjreã®ããŒãžã§ã³ïŒå€æ°$ {jdkVersion}ã«å¯Ÿå¿ïŒãå ¥åãã¡ã€ã«ãåºåãã¡ã€ã«ããã蟌ãã¢ã€ã³ã³ãexeãã¡ã€ã«ã«é¢ããæ å ±ã衚瀺ãããšãã«è¡šç€ºã§ããæ å ±ã瀺ããŸããã jreã®ããŒãžã§ã³çªå·ã$ {jdkVersion} .0ã®ããã«æžãããŠããã®ã¯ãªãã§ããïŒ éåžžã«ç°¡åã§ããlaunch4jãã©ã°ã€ã³ã«ã¯xxx [_x]圢åŒã®ããŒãžã§ã³çªå·ãå¿ èŠã§ããpom.xmlãã¡ã€ã«ã®ä»ã®å ŽæïŒã³ã³ãã€ã«ãã©ã°ã€ã³æ§æå ïŒã§ã¯ãxx圢åŒã®ããŒãžã§ã³çªå·ãæå®ããå¿ èŠããããŸãã ãããã£ãŠãäžè¬çãªéšåã¯å€æ°ã«å ¥ããããŸããïŒæåŸãåç §ïŒã
ãšããã§ããã©ã°ã€ã³ãã€ã³ã¿ãŒãããäžã®Mavenãªããžããªãããã«ã¢ããããããã«ã¯ïŒäžå€®ãªããžããªã«ãã®ãããªãã©ã°ã€ã³ã¯ãããŸããïŒããã1ã€æå®ããå¿ èŠããããŸãïŒ
<repositories> <repository> <id>akathist-repository</id> <name>Akathist Repository</name> <url>http://www.9stmaryrd.com/maven</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>akathist-repository</id> <name>Akathist Repository</name> <url>http://www.9stmaryrd.com/maven</url> </pluginRepository> </pluginRepositories>
ã¿ã°<repositories />ããã³<pluginRepositories />ã¯ããããžã§ã¯ãã®ã«ãŒãã¿ã°å ã«ãããŸãã äŸåé¢ä¿èšè¿°ã¿ã°ããã³ã¢ã»ã³ããªèšè¿°ã¿ã°ãšãšãã«ã
Mercurialãªããžããªãšåæ
æåã¯ããã©ã°ã€ã³ãã¢ã¯ãã£ããªãã©ã³ãã®æåŸã®ã³ãããã®çªå·ãååŸããããããããžã§ã¯ãã®ãã«ãçªå·ãšããŠæ¿å ¥ãããšããã¢ã€ãã¢ã§ããã ãããããããè¡ãæ¹æ³ã¯ããŸããããŸããã§ããã æããŠããã人ãã¡ã«ã¯ãšãŠãæè¬ããŠããŸãã
äžè¬ã«ããªããžããªã§äœæ¥ããããšã®æ¬è³ªã¯ããããžã§ã¯ãå šäœãçµã¿ç«ãŠãåã«ããªããžããªããææ°ã®å€æŽã確å®ã«åãåãããšã§ããã ããã§ãmaven-scm-pluginãã©ã°ã€ã³ã圹ã«ç«ã¡ãŸããã ããã«ãGitãšã¯ç°ãªããMercurialã®å®å šãªãµããŒããçºè¡šãããŸããã ãŸããç§ã¯æ°Žéãªããžããªã«æ £ããŠããã®ã§ãããã¯çŽ æŽãããã§ã:)ã æ§æã¯æ¬¡ã®ãšããã§ãã
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-scm-plugin</artifactId> <version>1.5</version> <configuration> <!-- <username>username</username> <password>password</password> //--> <connectiontype>developerConnection</connectiontype> </configuration> <executions> <execution> <phase>validate</phase> <goals> <goal>update</goal> </goals> </execution> </executions> </plugin>
ãã°ã€ã³ãšãã¹ã¯ãŒãã®ãã©ã¡ãŒã¿ãŒã¯ãèš±å¯ãå¿ èŠãšããã«ããŒã«ã«ãªããžããªãŒã䜿çšãããããã³ã¡ã³ãåãããŠããŸãã ã¯ãããšããã§ã<build />ã¿ã°ã®å€åŽã§ã¯ããªããžããªãé 眮ãããŠããå Žæã«ãã©ã¡ãŒã¿ãŒã瀺ãããŸãã
<scm> <connection>scm:hg:file:///${project.basedir}</connection> <developerConnection>scm:hg:file:///${project.basedir}</developerConnection> <url>file:///${project.basedir}</url> </scm>
ã©ã®ããã«ãäœããã©ãã§ç· ããã¹ããã«ã€ããŠã¯ãå ¬åŒããã¥ã¡ã³ãSCM ImplementationïŒMercurialã§å床説æãããŠããŸã ã ãªããžããªã«å¯ŸããŠãªã¯ãšã¹ããè¡ãããææ°ã®å€æŽãåãå ¥ãããããããžã§ã¯ãã®ææ°ããŒãžã§ã³ãååŸãããŸãïŒãã¡ãããã¢ã¯ãã£ããªãã©ã³ãã®ãã¬ãŒã ã¯ãŒã¯å ïŒã
ãã£ããã·ã¥ã©ã€ã³
æçµçãªç·ãåŒãããããžã§ã¯ãã«ãŠãŒã¶ãŒã®ããã¥ã¡ã³ããå«ãããã¹ãŠãã¢ãŒã«ã€ãã«ãŸãšããŠåã°ããããšãæ®ã£ãŠããŸãã maven-assembly-pluginããããæ åœããŸãã
<plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <id>assembly</id> <phase>package</phase> <goals> <goal>attached</goal> </goals> <configuration> <descriptors> <descriptor>assembly.xml</descriptor> </descriptors> </configuration> </execution> </executions> </plugin>
ãã©ã°ã€ã³ã®ããã¥ã¡ã³ãã§ã¯ãæ·»ä»ã®ã¿ãŒã²ããã䜿çšããããšã匷ããå§ãããŸãã æ§æå šäœã¯ãåå¥ã®assembly.xmlãã¡ã€ã«ã«ä¿åãããŸãã ãã®å 容ã¯æ¬¡ã®ãšããã§ãã
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> <id>bin</id> <formats> <format>zip</format> </formats> <fileSets> <fileSet> <directory>${project.basedir}</directory> <outputDirectory>/</outputDirectory> <includes> <include>data.ini</include> <include>ReleaseNotes.txt</include> </includes> </fileSet> <fileSet> <directory>${project.basedir}</directory> <outputDirectory>/docs</outputDirectory> <includes> <include>User's guide.pdf</include> </includes> </fileSet> <fileSet> <directory>${project.build.directory}</directory> <outputDirectory>/</outputDirectory> <includes> <include>${exeFileName}.exe</include> <include>${project.artifactId}-${project.version}.jar</include> <include>lib/**</include> </includes> </fileSet> </fileSets> </assembly>
ã©ã®ãã£ã¬ã¯ããªããã¢ã¿ããããå¿ èŠããããã瀺ããŸãïŒexeãã¡ã€ã«ãšãªã³ã¯ã©ã€ãã©ãªãå¿ããªãã§ãã ããïŒããã©ãŒãããã®ãªã¹ãã§ã¯ãzipã®ã¿ãæå®ããŸããæ®ãã¯ååãšããŠç§ã®å Žåã¯å¿ èŠãããŸããã ãã¹ãŠãåºåã§ã¯ãå¿ èŠãªãã®ããã¹ãŠå ¥ã£ãã¢ãŒã«ã€ããååŸããŸãïŒäž»ãªããšã¯äœãå¿ããªãããšã§ã:)ïŒã
å€æ°
ãã¹ãŠã®æ§æã¯ããããã®å€æ°ã§ãã£ã±ãã§ãã ãŸããæããŠãã ããã
-$ {project.basedir}-mavenã®ãããžã§ã¯ãã«ãŒããã£ã¬ã¯ããªãžã®ãã¹ãä¿åããŸãã
-$ {project.build.directory}-éåžžãmavenã®ãããžã§ã¯ãã®ã¿ãŒã²ãããµããã£ã¬ã¯ããªã«å¯Ÿå¿ããŸãã
-$ {project.build.outputDirectory}-ã³ã³ãã€ã«ããã.classãã¡ã€ã«ãè¿œå ãããã¿ãŒã²ããå ã®ãã£ã¬ã¯ããªã«å¯Ÿå¿ããŸãã éåžžãã¯ã©ã¹ã«ã¯ååãããããã®å 容ããæçµçãªjarã¢ãŒã«ã€ããåéãããŸãã
-$ {project.name}-<artifactId />ã¿ã°ããååŸããã¢ãŒãã£ãã¡ã¯ãã®åå
-$ {project.version}-ã¢ãŒãã£ãã¡ã¯ãããŒãžã§ã³ãã¿ã°å€<version />
æ®ãã®å€æ°ã¯ãpom.xmlãã¡ã€ã«ã®ã«ãŒã<project />ã¿ã°å ã®<properties />ã¿ã°ã§æåã§æ±ºå®ãããŸããã ãã®å 容ã¯æ¬¡ã®ãšããã§ãã
<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <exeFileName>block</exeFileName> <product.title> </product.title> <product.company> :)</product.company> <product.year>2011</product.year> <jdkVersion>1.6</jdkVersion> </properties>
exeãã¡ã€ã«ã®ååã¯æ¡åŒµåãªãã§æå®ãããŠããããšã«æ³šæããŠãã ããããªããªã launch4jãã©ã°ã€ã³æ§æã§ã¯ããã«ããŒã ãæå®ããå¿ èŠãããå Žåããããæ¡åŒµåãæå®ããªãå ŽåããããŸãã
ãããã«
Mavenã䜿çšããŠãã ããïŒ :)æéããããŠå匷ããããšã§ãåŸã§æéãç¯çŽã§ããŸãã
ãããã£ãŠãç§ã®ãããžã§ã¯ãã¯ããŒã«ã«ã®Mavenãªããžããªã«ãããŸãããããã®å ¬éããªã¢ãŒããªããžããªïŒçµç¹ã®ãããã¯ãŒã¯ãªã©ïŒã§æ§æã§ããŸãã Mercurialãªããžããªãããããžã§ã¯ããè€è£œãããšããã¹ãŠã®äŸåé¢ä¿ãèªåçã«åŒ·åãããŸã-éåžžã«äŸ¿å©ã§ãã ãããŠãå°ãªããšãNetBeansã§ãå°ãªããšãEclipseã§ãå°ãªããšãIntelliJ IDEAã§ãããžã§ã¯ããããã«éçºããŸã-奜ããªããã«ã
PSïŒãã¹ãŠã®äŸåé¢ä¿ã¯ã€ã³ã¿ãŒãããããååŸãããããŒã«ã«ã®Mavenãªããžããªã«è¿œå ãããå°æ¥ã¯ããããååŸãããŸãã ä»äºäžã®Mavenãããã·æ§æãNTLMèªèšŒãšäºææ§ããªããšããç§ã®ã幞çŠãã¯äœã ã£ãã®ã§ãå€ãã®äŸåé¢ä¿ãæåã§ããŠã³ããŒãããå¿ èŠãªãµããã£ã¬ã¯ããªã«å ¥ããå¿ èŠããããŸããã