2
votes

I installed the following;

microsoft visual team foundation server 2012 build extensions on tfs 2012 build server (http://visualstudiogallery.msdn.microsoft.com/45b4e378-5b81-4186-9b7f-21cc5c2f743d)

Java Dev Kit 6 update 45

Maven 3.1.1

tfs 2012 server configuration:

Windows 2012 Standart 64-bit machine. We use NTLM authentication and proxy.

I defined the following configuration:

Environment settings:

JAVA_HOME     C:\Program Files\Java\jdk1.6.0_45

M2            %M2_HOME%\bin

M2_HOME       C:\Program Files\Apache Software Foundation\apache-maven-3.1.1

Path:

  %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;%TFSPowerToolDir%;%BPADir%;%M2%;%JAVA_HOME%\bin

maven settings.xml:

<settings>
<proxies>
<proxy>   
  <active>true</active>
  <protocol>http</protocol>
  <host>proxy.xxx.entp</host>
  <port>8080</port>
  <username>myuser</username>
  <password>mypassword</password>
  <nonProxyHosts>*.xxx.entp|localhost</nonProxyHosts>
</proxy>
</proxies>
</settings>

I definited maven build with select pom file after installed Eclipse and team explorer everywhere for team foundation server on my client computer (http://www.microsoft.com/en-us/download/details.aspx?id=30661)

Maven build successed with "mvn assembly:assembly -P prod" command in windows command prompt. But does not work build definition when run. I added maven environment variables but tfs build does not found maven home, bin directory, boot directory. why? or any way?

the output build log:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\BuildExtensions\Microsoft.TeamFoundation.Build.Extensions.Maven2.targets - 4 error(s), 1 warning(s),View Log File

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\BuildExtensions\Microsoft.TeamFoundation.Build.Extensions.Maven2.targets (238): No bin directory found in MavenHome.

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\BuildExtensions\Microsoft.TeamFoundation.Build.Extensions.Maven2.targets (238): No boot directory found in MavenHome.

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\BuildExtensions\Microsoft.TeamFoundation.Build.Extensions.Maven2.targets (238): Object reference not set to an instance of an object. at System.Activities.WorkflowApplication.Invoke(Activity activity, IDictionary2 inputs, WorkflowInstanceExtensionManager extensions, TimeSpan timeout) at System.Activities.WorkflowInvoker.Invoke(Activity workflow, IDictionary2 inputs, TimeSpan timeout, WorkflowInstanceExtensionManager extensions) at Microsoft.TeamFoundation.Build.Extensions.Tasks.WorkflowTask.Execute()

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\BuildExtensions\Microsoft.TeamFoundation.Build.Extensions.Maven2.targets (238): The "Maven" task failed unexpectedly. System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.TeamFoundation.Build.Extensions.Tasks.WorkflowTask.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext()

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\BuildExtensions\Microsoft.TeamFoundation.Build.Extensions.Maven2.targets (238): Environment variable "JAVA_HOME" not found in running process, but was found in the user or machine settings. You may need to restart the build agent to pick up newly defined environment variables.

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\BuildExtensions\Microsoft.TeamFoundation.Build.Extensions.Maven2.targets compiled

No Test Results

No Code Coverage Results

Other Errors and Warnings

1 error(s), 0 warning(s)

Exception Message: TF270015: 'MSBuild.exe' returned an unexpected exit code. Expected '0'; actual '1'. See the build logs for more details. (type UnexpectedExitCodeException) Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

1

1 Answers

1
votes

I had the same problem. Apparently the relevant error and the solution is printed in the end of the message: "You may need to restart the build agent to pick up newly defined environment variables"

Restart the build agent and everything will work like magic.