the issue for classpath too long can be fixed by a different strategy using
a manifest's class-path with an empty jar file

  <property name="path.jar" value=" ${basedir}/dist/path.jar" />
>
>   <target name="compile" depends="pathjar">
>
>     <javac debug="on"
>
>            deprecation="off"
>
>            optimize="off"
>
>            destdir="${dest.dir}"
>
>            srcdir="${src.dir}"
>
>            includeantruntime="false"
>
>            encoding="ISO-8859-1"
>
>            fork="true">
>>
> <compilerarg line="-Xlint:${JAVA_LINT} " />
>
>                         <classpath path="${path.jar}" />
>
>        </javac>
>
> </target>
>
>

> <target name="pathjar">
>
>                 <delete file="${path.jar}" failonerror="false" />
>>
> <mkdir dir="${basedir}/dist" />
>
> <manifestclasspath jarfile="${path.jar}"
>
>                        property="pathjar.classpath"
>
>                        maxparentlevels="40" >
>
>                    <classpath refid="compile.classpath"/>
>
>                </manifestclasspath>
>
> <echo message="Class-Path: ${pathjar.classpath}" level="debug" />
>
>
>> <jar destfile="${path.jar}">
>
> <manifest>
>
> <attribute name="Implementation-Title" value="${ant.project.name}" />
>
>                                 <attribute name="Class-Path"
>> value="${pathjar.classpath}"/>
>>
> </manifest>
>
> </jar>
>
> </target>
>
>
>
>
On Mon, Aug 6, 2018 at 3:28 AM Pietro Paolini <
pietro.paol...@alfasystems.com> wrote:

> It is heavily intertwined with corporate stuff so I can't. it is a regular
> javac task whose class path is *huge* - the problem I reckon is that the
> command line parameters (which includes the
> Classpath) do not fit into the window's command line limit.
>
>
>
>        at
> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
>         at
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
>         at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
>         at org.apache.tools.ant.Main.runBuild(Main.java:857)
>         at org.apache.tools.ant.Main.startAnt(Main.java:236)
>         at org.apache.tools.ant.launch.Launcher.run(Launcher.java:287)
>         at org.apache.tools.ant.launch.Launcher.main(Launcher.java:113)
> Caused by: java.io.IOException: Cannot run program "C:\Program
> Files\Java\jdk1.8.0_144\bin\javac.exe" (in directory "xxxxx"):
> CreateProcess error=206, The filename or extension is too long
>         at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
>         at java.lang.Runtime.exec(Runtime.java:620)
>         at
> org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
>         at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:426)
>         at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:440)
>         at
> org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:598)
>         ... 101 more
> Caused by: java.io.IOException: CreateProcess error=206, The filename or
> extension is too long
>         at java.lang.ProcessImpl.create(Native Method)
>         at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
>         at java.lang.ProcessImpl.start(ProcessImpl.java:137)
>         at java.lang.Proc
>
>
>
> > -----Original Message-----
> > From: Jan Matèrne (jhm) [mailto:apa...@materne.de]
> > Sent: 05 August 2018 09:21
> > To: 'Ant Users List'
> > Subject: AW: [E] Javac: Command-Line Argument Files
> >
> > Could you post your buildfile snippet and the build output?
> >
> > Jan
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Jose M Urena [mailto:jose.ur...@verizon.com]
> > > Gesendet: Freitag, 3. August 2018 15:02
> > > An: Ant Users List
> > > Betreff: Re: [E] Javac: Command-Line Argument Files
> > >
> > > the following suggestion I have learned for working with Jenkins jobs
> > > which can have very long paths for the workspace
> > >
> > > 1. if you have permission on your computer/server to create windows
> > > shares and to run from shared drive, then you could save most of the
> > > characters to the left of your path by using PUSHD
> > >
> > > if your current dir is c:\users\yourname\documents\ which is  28
> > > characters then pushd will reduce it to 3, saving you 25 characters
> > >
> > > net share TEMPSHORTPATH=%CD% /grant:%USERNAME%,FULL pushd
> > > \\%COMPUTERNAME%.%USERDNSDOMAIN%\TEMPSHORTPATH
> > > ::  call your ant script
> > >
> > > ant
> > >
> > > :: leave the temp drive, remove it from windows shares popd net share
> > > /delete TEMPSHORTPATH
> > > :: confirm share was cleaned
> > > net use
> > > net share
> > >
> > > 2. if the issue is with commands under your c:\program files,  like
> > > c:\program files\oracle\jdk180\bin\javac you can try using MKLINK to
> > > remove spaces and shorten the path  mkdir c:\dev  cd c:\dev  mklink /j
> > > jdk "c:\program files\oracle\jdk180"
> > >
> > > now you can use c:\dev\jdk\bin\javac which is shorter than  c:\program
> > > files\oracle\jdk180\bin\javac
> > >
> > > 3. if you can not use PUSHD, mklink can be used to shorten paths but it
> > > is not as short as pushd mkdir c:\dev cd c:\dev mklink /j doc
> > > "c:\users\yourname\documents\"
> > >
> > >
> > >
> > > On Fri, Aug 3, 2018 at 6:25 AM Pietro Paolini <
> > > pietro.paol...@alfasystems.com> wrote:
> > >
> > > > Hi all,
> > > >
> > > > I am a bit struggling with an build.xml file <javac> task, I haven't
> > > > got too much experience with Ant but hopefully my question won't
> > > sound
> > > > too silly. On a window machine I reach the Command line limit size
> > > and
> > > > the compiler task fails as "the extension or file name is too long".
> > > >
> > > > I am wondering if  it could be possible to get advantage of
> > > >
> > > >
> > > > https://urldefense.proofpoint.com/v2/url?u=https-
> > > 3A__docs.oracle.com_j
> > > > avase_8_docs_technotes_tools_windows_javac.html-
> > > 23BHCJEIBB&d=DwIFAg&c=
> > > >
> > >
> > udBTRvFvXC5Dhqg7UHpJlPps3mZ3LRxpb6__0PomBTQ&r=8XYgcdEXHJW1PQ9
> > xb6NrZ5vl
> > > > BTrHBT7lhTNH6uwwINQ&m=LOtmbKv9Pf9JXdG7oo-wOJVmm0DBaI-
> > > biSoqKkmRB1Y&s=3d
> > > > 6wFJcoY-jzVaYoMjXRGQtLVB4MbjUD6j_Krv55Gp0&e=
> > > >
> > > > Is there a quick win on that ? I couldn't find much on Google :-(
> > > >
> > > > Thanks,
> > > > Pietro
> > > >
> > > >
> > > > Pietro Paolini
> > > > Consultant
> > > >
> > > > Alfa
> > > > ________________________________
> > > > e: pietro.paol...@alfasystems.com | w: alfasystems.com<
> > > > https://urldefense.proofpoint.com/v2/url?u=https-
> > > 3A__www.alfasystems.c
> > > >
> > >
> > om&d=DwIFAg&c=udBTRvFvXC5Dhqg7UHpJlPps3mZ3LRxpb6__0PomBTQ&r=
> > 8XYgcdEXHJ
> > > > W1PQ9xb6NrZ5vlBTrHBT7lhTNH6uwwINQ&m=LOtmbKv9Pf9JXdG7oo-
> > wOJVmm0DBaI-
> > > biS
> > > > oqKkmRB1Y&s=bNk8SVZHcZac3KOa02xtQCXPIhrz3JfJRZfiaFUIVUk&e=
> > > > >
> > > > t: +44 (0) 20 7920-2643 | Moor Place, 1 Fore Street Avenue, London,
> > > > EC2Y 9DT, GB ________________________________
> > > >
> > > > The contents of this communication are not intended to be binding or
> > > > constitute any form of offer or acceptance or give rise to any legal
> > > > obligations on behalf of the sender or Alfa. The views or opinions
> > > > expressed represent those of the author and not necessarily those of
> > > Alfa.
> > > > This email and any attachments are strictly confidential and are
> > > > intended solely for use by the individual or entity to whom it is
> > > > addressed. If you are not the addressee (or responsible for delivery
> > > > of the message to the
> > > > addressee) you may not copy, forward, disclose or use any part of the
> > > > message or its attachments. At present the integrity of email across
> > > > the internet cannot be guaranteed and messages sent via this medium
> > > > are potentially at risk. All liability is excluded to the extent
> > > > permitted by law for any claims arising as a result of the use of
> > > this
> > > > medium to transmit information by or to Alfa or its affiliates.
> > > >
> > > > Alfa Financial Software Ltd
> > > > Reg. in England No: 0248 2325
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For
> > > additional
> > > > commands, e-mail: user-h...@ant.apache.org
> > > >
> > > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
> > For additional commands, e-mail: user-h...@ant.apache.org
>
>

Reply via email to